ofproto/nx_actions: Update arguments to be compatible with ovs-ofctl
This patch, update the methods that are to be specified in the NXM or OXM. Update the value specified in the bit format to the start and end formats. Update the following NXAction. - NXActionRegLoad - NXActionOutputReg - NXActionMultipath - NXActionBundle - NXActionBundleLoad - NXActionCT Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
ecc3ea296f
commit
3c3896fd77
@ -228,11 +228,11 @@ def generate(ofp_name, ofpp_name):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, ofs, nbits, dst, value,
|
def __init__(self, start, end, dst, value,
|
||||||
type_=None, len_=None, experimenter=None, subtype=None):
|
type_=None, len_=None, experimenter=None, subtype=None):
|
||||||
super(NXActionRegLoad, self).__init__()
|
super(NXActionRegLoad, self).__init__()
|
||||||
self.ofs = ofs
|
self.start = start
|
||||||
self.nbits = nbits
|
self.end = end
|
||||||
self.dst = dst
|
self.dst = dst
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
@ -240,11 +240,11 @@ def generate(ofp_name, ofpp_name):
|
|||||||
def parser(cls, buf):
|
def parser(cls, buf):
|
||||||
(ofs_nbits, dst, value,) = struct.unpack_from(
|
(ofs_nbits, dst, value,) = struct.unpack_from(
|
||||||
cls._fmt_str, buf, 0)
|
cls._fmt_str, buf, 0)
|
||||||
ofs = ofs_nbits >> 6
|
start = ofs_nbits >> 6
|
||||||
nbits = (ofs_nbits & ((1 << 6) - 1)) + 1
|
end = (ofs_nbits & 0x3f) + start
|
||||||
# Right-shift instead of using oxm_parse_header for simplicity...
|
# Right-shift instead of using oxm_parse_header for simplicity...
|
||||||
dst_name = ofp.oxm_to_user_header(dst >> 9)
|
dst_name = ofp.oxm_to_user_header(dst >> 9)
|
||||||
return cls(ofs, nbits, dst_name, value)
|
return cls(start, end, dst_name, value)
|
||||||
|
|
||||||
def serialize_body(self):
|
def serialize_body(self):
|
||||||
hdr_data = bytearray()
|
hdr_data = bytearray()
|
||||||
@ -252,7 +252,7 @@ def generate(ofp_name, ofpp_name):
|
|||||||
ofp.oxm_serialize_header(n, hdr_data, 0)
|
ofp.oxm_serialize_header(n, hdr_data, 0)
|
||||||
(dst_num,) = struct.unpack_from('!I', six.binary_type(hdr_data), 0)
|
(dst_num,) = struct.unpack_from('!I', six.binary_type(hdr_data), 0)
|
||||||
|
|
||||||
ofs_nbits = (self.ofs << 6) + self.nbits - 1
|
ofs_nbits = (self.start << 6) + (self.end - self.start)
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
msg_pack_into(self._fmt_str, data, 0,
|
msg_pack_into(self._fmt_str, data, 0,
|
||||||
ofs_nbits, dst_num, self.value)
|
ofs_nbits, dst_num, self.value)
|
||||||
@ -432,12 +432,14 @@ def generate(ofp_name, ofpp_name):
|
|||||||
_fmt_str = '!HIH6x'
|
_fmt_str = '!HIH6x'
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
ofs_nbits,
|
start,
|
||||||
|
end,
|
||||||
src,
|
src,
|
||||||
max_len,
|
max_len,
|
||||||
type_=None, len_=None, experimenter=None, subtype=None):
|
type_=None, len_=None, experimenter=None, subtype=None):
|
||||||
super(NXActionOutputReg, self).__init__()
|
super(NXActionOutputReg, self).__init__()
|
||||||
self.ofs_nbits = ofs_nbits
|
self.start = start
|
||||||
|
self.end = end
|
||||||
self.src = src
|
self.src = src
|
||||||
self.max_len = max_len
|
self.max_len = max_len
|
||||||
|
|
||||||
@ -447,12 +449,16 @@ def generate(ofp_name, ofpp_name):
|
|||||||
src,
|
src,
|
||||||
max_len) = struct.unpack_from(
|
max_len) = struct.unpack_from(
|
||||||
cls._fmt_str, buf, 0)
|
cls._fmt_str, buf, 0)
|
||||||
return cls(ofs_nbits,
|
start = ofs_nbits >> 6
|
||||||
|
end = (ofs_nbits & 0x3f) + start
|
||||||
|
return cls(start,
|
||||||
|
end,
|
||||||
src,
|
src,
|
||||||
max_len)
|
max_len)
|
||||||
|
|
||||||
def serialize_body(self):
|
def serialize_body(self):
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
|
ofs_nbits = (self.start << 6) + (self.end - self.start)
|
||||||
msg_pack_into(self._fmt_str, data, 0,
|
msg_pack_into(self._fmt_str, data, 0,
|
||||||
ofs_nbits,
|
ofs_nbits,
|
||||||
self.src,
|
self.src,
|
||||||
@ -660,7 +666,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
algorithm,
|
algorithm,
|
||||||
max_link,
|
max_link,
|
||||||
arg,
|
arg,
|
||||||
ofs_nbits,
|
start,
|
||||||
|
end,
|
||||||
dst,
|
dst,
|
||||||
type_=None, len_=None, experimenter=None, subtype=None):
|
type_=None, len_=None, experimenter=None, subtype=None):
|
||||||
super(NXActionMultipath, self).__init__()
|
super(NXActionMultipath, self).__init__()
|
||||||
@ -669,7 +676,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
self.algorithm = algorithm
|
self.algorithm = algorithm
|
||||||
self.max_link = max_link
|
self.max_link = max_link
|
||||||
self.arg = arg
|
self.arg = arg
|
||||||
self.ofs_nbits = ofs_nbits
|
self.start = start
|
||||||
|
self.end = end
|
||||||
self.dst = dst
|
self.dst = dst
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -682,15 +690,19 @@ def generate(ofp_name, ofpp_name):
|
|||||||
ofs_nbits,
|
ofs_nbits,
|
||||||
dst) = struct.unpack_from(
|
dst) = struct.unpack_from(
|
||||||
cls._fmt_str, buf, 0)
|
cls._fmt_str, buf, 0)
|
||||||
|
start = ofs_nbits >> 6
|
||||||
|
end = (ofs_nbits & 0x3f) + start
|
||||||
return cls(fields,
|
return cls(fields,
|
||||||
basis,
|
basis,
|
||||||
algorithm,
|
algorithm,
|
||||||
max_link,
|
max_link,
|
||||||
arg,
|
arg,
|
||||||
ofs_nbits,
|
start,
|
||||||
|
end,
|
||||||
dst)
|
dst)
|
||||||
|
|
||||||
def serialize_body(self):
|
def serialize_body(self):
|
||||||
|
ofs_nbits = (self.start << 6) + (self.end - self.start)
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
msg_pack_into(self._fmt_str, data, 0,
|
msg_pack_into(self._fmt_str, data, 0,
|
||||||
self.fields,
|
self.fields,
|
||||||
@ -698,7 +710,7 @@ def generate(ofp_name, ofpp_name):
|
|||||||
self.algorithm,
|
self.algorithm,
|
||||||
self.max_link,
|
self.max_link,
|
||||||
self.arg,
|
self.arg,
|
||||||
self.ofs_nbits,
|
ofs_nbits,
|
||||||
self.dst)
|
self.dst)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -708,7 +720,7 @@ def generate(ofp_name, ofpp_name):
|
|||||||
_fmt_str = '!HHHIHHI4x'
|
_fmt_str = '!HHHIHHI4x'
|
||||||
|
|
||||||
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
||||||
ofs_nbits, dst, slaves):
|
start, end, dst, slaves):
|
||||||
super(_NXActionBundleBase, self).__init__()
|
super(_NXActionBundleBase, self).__init__()
|
||||||
self.len = utils.round_up(
|
self.len = utils.round_up(
|
||||||
nicira_ext.NX_ACTION_BUNDLE_0_SIZE + len(slaves) * 2, 8)
|
nicira_ext.NX_ACTION_BUNDLE_0_SIZE + len(slaves) * 2, 8)
|
||||||
@ -718,7 +730,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
self.basis = basis
|
self.basis = basis
|
||||||
self.slave_type = slave_type
|
self.slave_type = slave_type
|
||||||
self.n_slaves = n_slaves
|
self.n_slaves = n_slaves
|
||||||
self.ofs_nbits = ofs_nbits
|
self.start = start
|
||||||
|
self.end = end
|
||||||
self.dst = dst
|
self.dst = dst
|
||||||
|
|
||||||
assert isinstance(slaves, (list, tuple))
|
assert isinstance(slaves, (list, tuple))
|
||||||
@ -732,6 +745,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
(algorithm, fields, basis,
|
(algorithm, fields, basis,
|
||||||
slave_type, n_slaves, ofs_nbits, dst) = struct.unpack_from(
|
slave_type, n_slaves, ofs_nbits, dst) = struct.unpack_from(
|
||||||
cls._fmt_str, buf, 0)
|
cls._fmt_str, buf, 0)
|
||||||
|
start = ofs_nbits >> 6
|
||||||
|
end = (ofs_nbits & 0x3f) + start
|
||||||
slave_offset = (nicira_ext.NX_ACTION_BUNDLE_0_SIZE -
|
slave_offset = (nicira_ext.NX_ACTION_BUNDLE_0_SIZE -
|
||||||
nicira_ext.NX_ACTION_HEADER_0_SIZE)
|
nicira_ext.NX_ACTION_HEADER_0_SIZE)
|
||||||
|
|
||||||
@ -742,9 +757,10 @@ def generate(ofp_name, ofpp_name):
|
|||||||
slave_offset += 2
|
slave_offset += 2
|
||||||
|
|
||||||
return cls(algorithm, fields, basis, slave_type,
|
return cls(algorithm, fields, basis, slave_type,
|
||||||
n_slaves, ofs_nbits, dst, slaves)
|
n_slaves, start, end, dst, slaves)
|
||||||
|
|
||||||
def serialize_body(self):
|
def serialize_body(self):
|
||||||
|
ofs_nbits = (self.start << 6) + (self.end - self.start)
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
slave_offset = (nicira_ext.NX_ACTION_BUNDLE_0_SIZE -
|
slave_offset = (nicira_ext.NX_ACTION_BUNDLE_0_SIZE -
|
||||||
nicira_ext.NX_ACTION_HEADER_0_SIZE)
|
nicira_ext.NX_ACTION_HEADER_0_SIZE)
|
||||||
@ -761,7 +777,7 @@ def generate(ofp_name, ofpp_name):
|
|||||||
msg_pack_into(self._fmt_str, data, 0,
|
msg_pack_into(self._fmt_str, data, 0,
|
||||||
self.algorithm, self.fields, self.basis,
|
self.algorithm, self.fields, self.basis,
|
||||||
self.slave_type, self.n_slaves,
|
self.slave_type, self.n_slaves,
|
||||||
self.ofs_nbits, self.dst)
|
ofs_nbits, self.dst)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -769,25 +785,25 @@ def generate(ofp_name, ofpp_name):
|
|||||||
_subtype = nicira_ext.NXAST_BUNDLE
|
_subtype = nicira_ext.NXAST_BUNDLE
|
||||||
|
|
||||||
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
||||||
ofs_nbits, dst, slaves):
|
start, end, dst, slaves):
|
||||||
# NXAST_BUNDLE actions should have 'ofs_nbits' and 'dst' zeroed.
|
# NXAST_BUNDLE actions should have 'ofs_nbits' and 'dst' zeroed.
|
||||||
super(NXActionBundle, self).__init__(
|
super(NXActionBundle, self).__init__(
|
||||||
algorithm, fields, basis, slave_type, n_slaves,
|
algorithm, fields, basis, slave_type, n_slaves,
|
||||||
ofs_nbits=0, dst=0, slaves=slaves)
|
start=0, end=0, dst=0, slaves=slaves)
|
||||||
|
|
||||||
class NXActionBundleLoad(_NXActionBundleBase):
|
class NXActionBundleLoad(_NXActionBundleBase):
|
||||||
_subtype = nicira_ext.NXAST_BUNDLE_LOAD
|
_subtype = nicira_ext.NXAST_BUNDLE_LOAD
|
||||||
|
|
||||||
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
def __init__(self, algorithm, fields, basis, slave_type, n_slaves,
|
||||||
ofs_nbits, dst, slaves):
|
start, end, dst, slaves):
|
||||||
super(NXActionBundleLoad, self).__init__(
|
super(NXActionBundleLoad, self).__init__(
|
||||||
algorithm, fields, basis, slave_type, n_slaves,
|
algorithm, fields, basis, slave_type, n_slaves,
|
||||||
ofs_nbits, dst, slaves)
|
start, end, dst, slaves)
|
||||||
|
|
||||||
class NXActionCT(NXAction):
|
class NXActionCT(NXAction):
|
||||||
_subtype = nicira_ext.NXAST_CT
|
_subtype = nicira_ext.NXAST_CT
|
||||||
|
|
||||||
# flags, zone_src, zone_ofs_nbits (zone_imm), recirc_table,
|
# flags, zone_src, zone_ofs_nbits, recirc_table,
|
||||||
# pad, alg
|
# pad, alg
|
||||||
_fmt_str = '!HIHB3xH'
|
_fmt_str = '!HIHB3xH'
|
||||||
# Followed by actions
|
# Followed by actions
|
||||||
@ -795,7 +811,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
flags,
|
flags,
|
||||||
zone_src,
|
zone_src,
|
||||||
zone_ofs_nbits, # is zone_imm if zone_src == 0
|
zone_start,
|
||||||
|
zone_end,
|
||||||
recirc_table,
|
recirc_table,
|
||||||
alg,
|
alg,
|
||||||
actions,
|
actions,
|
||||||
@ -803,7 +820,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
super(NXActionCT, self).__init__()
|
super(NXActionCT, self).__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.zone_src = zone_src
|
self.zone_src = zone_src
|
||||||
self.zone_ofs_nbits = zone_ofs_nbits
|
self.zone_start = zone_start
|
||||||
|
self.zone_end = zone_end
|
||||||
self.recirc_table = recirc_table
|
self.recirc_table = recirc_table
|
||||||
self.alg = alg
|
self.alg = alg
|
||||||
self.actions = actions
|
self.actions = actions
|
||||||
@ -816,6 +834,8 @@ def generate(ofp_name, ofpp_name):
|
|||||||
recirc_table,
|
recirc_table,
|
||||||
alg,) = struct.unpack_from(
|
alg,) = struct.unpack_from(
|
||||||
cls._fmt_str, buf, 0)
|
cls._fmt_str, buf, 0)
|
||||||
|
zone_start = zone_ofs_nbits >> 6
|
||||||
|
zone_end = (zone_ofs_nbits & 0x3f) + zone_start
|
||||||
rest = buf[struct.calcsize(cls._fmt_str):]
|
rest = buf[struct.calcsize(cls._fmt_str):]
|
||||||
# actions
|
# actions
|
||||||
actions = []
|
actions = []
|
||||||
@ -824,15 +844,17 @@ def generate(ofp_name, ofpp_name):
|
|||||||
actions.append(action)
|
actions.append(action)
|
||||||
rest = rest[action.len:]
|
rest = rest[action.len:]
|
||||||
|
|
||||||
return cls(flags, zone_src, zone_ofs_nbits, recirc_table,
|
return cls(flags, zone_src, zone_start, zone_end, recirc_table,
|
||||||
alg, actions)
|
alg, actions)
|
||||||
|
|
||||||
def serialize_body(self):
|
def serialize_body(self):
|
||||||
|
zone_ofs_nbits = ((self.zone_start << 6) +
|
||||||
|
(self.zone_end - self.zone_start))
|
||||||
data = bytearray()
|
data = bytearray()
|
||||||
msg_pack_into(self._fmt_str, data, 0,
|
msg_pack_into(self._fmt_str, data, 0,
|
||||||
self.flags,
|
self.flags,
|
||||||
self.zone_src,
|
self.zone_src,
|
||||||
self.zone_ofs_nbits,
|
zone_ofs_nbits,
|
||||||
self.recirc_table,
|
self.recirc_table,
|
||||||
self.alg)
|
self.alg)
|
||||||
for a in self.actions:
|
for a in self.actions:
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
"recirc_table": 4,
|
"recirc_table": 4,
|
||||||
"subtype": 35,
|
"subtype": 35,
|
||||||
"type": 65535,
|
"type": 65535,
|
||||||
"zone_ofs_nbits": 0,
|
"zone_start": 0,
|
||||||
|
"zone_end": 0,
|
||||||
"zone_src": 0
|
"zone_src": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
"recirc_table": 255,
|
"recirc_table": 255,
|
||||||
"subtype": 35,
|
"subtype": 35,
|
||||||
"type": 65535,
|
"type": 65535,
|
||||||
"zone_ofs_nbits": 0,
|
"zone_start": 0,
|
||||||
|
"zone_end": 0,
|
||||||
"zone_src": 0
|
"zone_src": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
"recirc_table": 255,
|
"recirc_table": 255,
|
||||||
"subtype": 35,
|
"subtype": 35,
|
||||||
"type": 65535,
|
"type": 65535,
|
||||||
"zone_ofs_nbits": 0,
|
"zone_start": 0,
|
||||||
|
"zone_end": 0,
|
||||||
"zone_src": 0
|
"zone_src": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
"recirc_table": 255,
|
"recirc_table": 255,
|
||||||
"subtype": 35,
|
"subtype": 35,
|
||||||
"type": 65535,
|
"type": 65535,
|
||||||
"zone_ofs_nbits": 0,
|
"zone_start": 0,
|
||||||
|
"zone_end": 0,
|
||||||
"zone_src": 0
|
"zone_src": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
"dst": "reg0",
|
"dst": "reg0",
|
||||||
"experimenter": 8992,
|
"experimenter": 8992,
|
||||||
"len": 24,
|
"len": 24,
|
||||||
"nbits": 28,
|
"end": 31,
|
||||||
"ofs": 4,
|
"start": 4,
|
||||||
"subtype": 7,
|
"subtype": 7,
|
||||||
"type": 65535,
|
"type": 65535,
|
||||||
"value": 233495534
|
"value": 233495534
|
||||||
|
@ -1421,6 +1421,8 @@ class TestNXActionRegLoad(unittest.TestCase):
|
|||||||
dst = {'buf': b'\x9f\x9f\x88\x26', 'val': 2678032422}
|
dst = {'buf': b'\x9f\x9f\x88\x26', 'val': 2678032422}
|
||||||
value = {'buf': b'\x33\x51\xcd\x43\x25\x28\x18\x99',
|
value = {'buf': b'\x33\x51\xcd\x43\x25\x28\x18\x99',
|
||||||
'val': 3697962457317775513}
|
'val': 3697962457317775513}
|
||||||
|
start = 246
|
||||||
|
end = 270
|
||||||
|
|
||||||
buf = type_['buf'] \
|
buf = type_['buf'] \
|
||||||
+ len_['buf'] \
|
+ len_['buf'] \
|
||||||
@ -1430,7 +1432,8 @@ class TestNXActionRegLoad(unittest.TestCase):
|
|||||||
+ dst['buf'] \
|
+ dst['buf'] \
|
||||||
+ value['buf']
|
+ value['buf']
|
||||||
|
|
||||||
c = NXActionRegLoad(ofs_nbits['val'],
|
c = NXActionRegLoad(start,
|
||||||
|
end,
|
||||||
dst['val'],
|
dst['val'],
|
||||||
value['val'])
|
value['val'])
|
||||||
|
|
||||||
@ -1445,13 +1448,15 @@ class TestNXActionRegLoad(unittest.TestCase):
|
|||||||
eq_(self.len_['val'], self.c.len)
|
eq_(self.len_['val'], self.c.len)
|
||||||
eq_(self.vendor['val'], self.c.vendor)
|
eq_(self.vendor['val'], self.c.vendor)
|
||||||
eq_(self.subtype['val'], self.c.subtype)
|
eq_(self.subtype['val'], self.c.subtype)
|
||||||
eq_(self.ofs_nbits['val'], self.c.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.dst['val'], self.c.dst)
|
eq_(self.dst['val'], self.c.dst)
|
||||||
eq_(self.value['val'], self.c.value)
|
eq_(self.value['val'], self.c.value)
|
||||||
|
|
||||||
def test_parser(self):
|
def test_parser(self):
|
||||||
res = self.c.parser(self.buf, 0)
|
res = self.c.parser(self.buf, 0)
|
||||||
eq_(self.ofs_nbits['val'], res.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.dst['val'], res.dst)
|
eq_(self.dst['val'], res.dst)
|
||||||
eq_(self.value['val'], res.value)
|
eq_(self.value['val'], res.value)
|
||||||
|
|
||||||
@ -1547,6 +1552,8 @@ class TestNXActionMultipath(unittest.TestCase):
|
|||||||
zfill1 = b'\x00' * 2
|
zfill1 = b'\x00' * 2
|
||||||
ofs_nbits = {'buf': b'\xa9\x9a', 'val': 43418}
|
ofs_nbits = {'buf': b'\xa9\x9a', 'val': 43418}
|
||||||
dst = {'buf': b'\xb9\x2f\x16\x64', 'val': 3106870884}
|
dst = {'buf': b'\xb9\x2f\x16\x64', 'val': 3106870884}
|
||||||
|
start = 678
|
||||||
|
end = 704
|
||||||
|
|
||||||
buf = type_['buf'] \
|
buf = type_['buf'] \
|
||||||
+ len_['buf'] \
|
+ len_['buf'] \
|
||||||
@ -1567,7 +1574,8 @@ class TestNXActionMultipath(unittest.TestCase):
|
|||||||
algorithm['val'],
|
algorithm['val'],
|
||||||
max_link['val'],
|
max_link['val'],
|
||||||
arg['val'],
|
arg['val'],
|
||||||
ofs_nbits['val'],
|
start,
|
||||||
|
end,
|
||||||
dst['val'])
|
dst['val'])
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -1582,7 +1590,8 @@ class TestNXActionMultipath(unittest.TestCase):
|
|||||||
eq_(self.algorithm['val'], self.c.algorithm)
|
eq_(self.algorithm['val'], self.c.algorithm)
|
||||||
eq_(self.max_link['val'], self.c.max_link)
|
eq_(self.max_link['val'], self.c.max_link)
|
||||||
eq_(self.arg['val'], self.c.arg)
|
eq_(self.arg['val'], self.c.arg)
|
||||||
eq_(self.ofs_nbits['val'], self.c.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.dst['val'], self.c.dst)
|
eq_(self.dst['val'], self.c.dst)
|
||||||
|
|
||||||
def test_parser(self):
|
def test_parser(self):
|
||||||
@ -1593,7 +1602,8 @@ class TestNXActionMultipath(unittest.TestCase):
|
|||||||
eq_(self.algorithm['val'], res.algorithm)
|
eq_(self.algorithm['val'], res.algorithm)
|
||||||
eq_(self.max_link['val'], res.max_link)
|
eq_(self.max_link['val'], res.max_link)
|
||||||
eq_(self.arg['val'], res.arg)
|
eq_(self.arg['val'], res.arg)
|
||||||
eq_(self.ofs_nbits['val'], res.ofs_nbits)
|
eq_(self.start, res.start)
|
||||||
|
eq_(self.end, res.end)
|
||||||
eq_(self.dst['val'], res.dst)
|
eq_(self.dst['val'], res.dst)
|
||||||
|
|
||||||
def test_serialize(self):
|
def test_serialize(self):
|
||||||
@ -1634,12 +1644,14 @@ class TestNXActionBundle(unittest.TestCase):
|
|||||||
basis = {'buf': b'\xfd\x6f', 'val': 64879}
|
basis = {'buf': b'\xfd\x6f', 'val': 64879}
|
||||||
slave_type = {'buf': b'\x7c\x51\x0f\xe0', 'val': 2085687264}
|
slave_type = {'buf': b'\x7c\x51\x0f\xe0', 'val': 2085687264}
|
||||||
n_slaves = {'buf': b'\x00\x02', 'val': 2}
|
n_slaves = {'buf': b'\x00\x02', 'val': 2}
|
||||||
ofs_nbits = {'buf': b'\xec\xf7', 'val': 60663}
|
ofs_nbits = {'buf': b'\x00\x00', 'val': 0}
|
||||||
dst = {'buf': b'\x50\x7c\x75\xfe', 'val': 1350333950}
|
dst = {'buf': b'\x00\x00\x00\x00', 'val': 0}
|
||||||
zfill = b'\x00' * 4
|
zfill = b'\x00' * 4
|
||||||
|
|
||||||
slaves_buf = (b'\x00\x01', b'\x00\x02')
|
slaves_buf = (b'\x00\x01', b'\x00\x02')
|
||||||
slaves_val = (1, 2)
|
slaves_val = (1, 2)
|
||||||
|
start = 0
|
||||||
|
end = 0
|
||||||
|
|
||||||
_len = len_['val'] + len(slaves_val) * 2
|
_len = len_['val'] + len(slaves_val) * 2
|
||||||
_len += (_len % 8)
|
_len += (_len % 8)
|
||||||
@ -1664,7 +1676,8 @@ class TestNXActionBundle(unittest.TestCase):
|
|||||||
basis['val'],
|
basis['val'],
|
||||||
slave_type['val'],
|
slave_type['val'],
|
||||||
n_slaves['val'],
|
n_slaves['val'],
|
||||||
ofs_nbits['val'],
|
start,
|
||||||
|
end,
|
||||||
dst['val'],
|
dst['val'],
|
||||||
slaves_val)
|
slaves_val)
|
||||||
|
|
||||||
@ -1684,7 +1697,8 @@ class TestNXActionBundle(unittest.TestCase):
|
|||||||
eq_(self.basis['val'], self.c.basis)
|
eq_(self.basis['val'], self.c.basis)
|
||||||
eq_(self.slave_type['val'], self.c.slave_type)
|
eq_(self.slave_type['val'], self.c.slave_type)
|
||||||
eq_(self.n_slaves['val'], self.c.n_slaves)
|
eq_(self.n_slaves['val'], self.c.n_slaves)
|
||||||
eq_(self.ofs_nbits['val'], self.c.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.dst['val'], self.c.dst)
|
eq_(self.dst['val'], self.c.dst)
|
||||||
|
|
||||||
# slaves
|
# slaves
|
||||||
@ -1704,7 +1718,8 @@ class TestNXActionBundle(unittest.TestCase):
|
|||||||
eq_(self.basis['val'], res.basis)
|
eq_(self.basis['val'], res.basis)
|
||||||
eq_(self.slave_type['val'], res.slave_type)
|
eq_(self.slave_type['val'], res.slave_type)
|
||||||
eq_(self.n_slaves['val'], res.n_slaves)
|
eq_(self.n_slaves['val'], res.n_slaves)
|
||||||
eq_(self.ofs_nbits['val'], res.ofs_nbits)
|
eq_(self.start, res.start)
|
||||||
|
eq_(self.end, res.end)
|
||||||
eq_(self.dst['val'], res.dst)
|
eq_(self.dst['val'], res.dst)
|
||||||
|
|
||||||
# slaves
|
# slaves
|
||||||
@ -1756,6 +1771,8 @@ class TestNXActionBundleLoad(unittest.TestCase):
|
|||||||
ofs_nbits = {'buf': b'\xd2\x9d', 'val': 53917}
|
ofs_nbits = {'buf': b'\xd2\x9d', 'val': 53917}
|
||||||
dst = {'buf': b'\x37\xfe\xb3\x60', 'val': 939438944}
|
dst = {'buf': b'\x37\xfe\xb3\x60', 'val': 939438944}
|
||||||
zfill = b'\x00' * 4
|
zfill = b'\x00' * 4
|
||||||
|
start = 842
|
||||||
|
end = 871
|
||||||
|
|
||||||
slaves_buf = (b'\x00\x01', b'\x00\x02')
|
slaves_buf = (b'\x00\x01', b'\x00\x02')
|
||||||
slaves_val = (1, 2)
|
slaves_val = (1, 2)
|
||||||
@ -1783,7 +1800,8 @@ class TestNXActionBundleLoad(unittest.TestCase):
|
|||||||
basis['val'],
|
basis['val'],
|
||||||
slave_type['val'],
|
slave_type['val'],
|
||||||
n_slaves['val'],
|
n_slaves['val'],
|
||||||
ofs_nbits['val'],
|
start,
|
||||||
|
end,
|
||||||
dst['val'],
|
dst['val'],
|
||||||
slaves_val)
|
slaves_val)
|
||||||
|
|
||||||
@ -1803,7 +1821,8 @@ class TestNXActionBundleLoad(unittest.TestCase):
|
|||||||
eq_(self.basis['val'], self.c.basis)
|
eq_(self.basis['val'], self.c.basis)
|
||||||
eq_(self.slave_type['val'], self.c.slave_type)
|
eq_(self.slave_type['val'], self.c.slave_type)
|
||||||
eq_(self.n_slaves['val'], self.c.n_slaves)
|
eq_(self.n_slaves['val'], self.c.n_slaves)
|
||||||
eq_(self.ofs_nbits['val'], self.c.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.dst['val'], self.c.dst)
|
eq_(self.dst['val'], self.c.dst)
|
||||||
|
|
||||||
# slaves
|
# slaves
|
||||||
@ -1823,7 +1842,8 @@ class TestNXActionBundleLoad(unittest.TestCase):
|
|||||||
eq_(self.basis['val'], res.basis)
|
eq_(self.basis['val'], res.basis)
|
||||||
eq_(self.slave_type['val'], res.slave_type)
|
eq_(self.slave_type['val'], res.slave_type)
|
||||||
eq_(self.n_slaves['val'], res.n_slaves)
|
eq_(self.n_slaves['val'], res.n_slaves)
|
||||||
eq_(self.ofs_nbits['val'], res.ofs_nbits)
|
eq_(self.start, res.start)
|
||||||
|
eq_(self.end, res.end)
|
||||||
eq_(self.dst['val'], res.dst)
|
eq_(self.dst['val'], res.dst)
|
||||||
|
|
||||||
# slaves
|
# slaves
|
||||||
@ -1870,6 +1890,8 @@ class TestNXActionOutputReg(unittest.TestCase):
|
|||||||
src = {'buf': b'\x5e\x3a\x04\x26', 'val': 1580860454}
|
src = {'buf': b'\x5e\x3a\x04\x26', 'val': 1580860454}
|
||||||
max_len = {'buf': b'\x00\x08', 'val': ofproto.OFP_ACTION_OUTPUT_SIZE}
|
max_len = {'buf': b'\x00\x08', 'val': ofproto.OFP_ACTION_OUTPUT_SIZE}
|
||||||
zfill = b'\x00' * 6
|
zfill = b'\x00' * 6
|
||||||
|
start = 1017
|
||||||
|
end = 1073
|
||||||
|
|
||||||
buf = type_['buf'] \
|
buf = type_['buf'] \
|
||||||
+ len_['buf'] \
|
+ len_['buf'] \
|
||||||
@ -1880,7 +1902,8 @@ class TestNXActionOutputReg(unittest.TestCase):
|
|||||||
+ max_len['buf'] \
|
+ max_len['buf'] \
|
||||||
+ zfill
|
+ zfill
|
||||||
|
|
||||||
c = NXActionOutputReg(ofs_nbits['val'],
|
c = NXActionOutputReg(start,
|
||||||
|
end,
|
||||||
src['val'],
|
src['val'],
|
||||||
max_len['val'])
|
max_len['val'])
|
||||||
|
|
||||||
@ -1895,7 +1918,8 @@ class TestNXActionOutputReg(unittest.TestCase):
|
|||||||
eq_(self.len_['val'], self.c.len)
|
eq_(self.len_['val'], self.c.len)
|
||||||
eq_(self.vendor['val'], self.c.vendor)
|
eq_(self.vendor['val'], self.c.vendor)
|
||||||
eq_(self.subtype['val'], self.c.subtype)
|
eq_(self.subtype['val'], self.c.subtype)
|
||||||
eq_(self.ofs_nbits['val'], self.c.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.src['val'], self.c.src)
|
eq_(self.src['val'], self.c.src)
|
||||||
eq_(self.max_len['val'], self.c.max_len)
|
eq_(self.max_len['val'], self.c.max_len)
|
||||||
|
|
||||||
@ -1906,7 +1930,8 @@ class TestNXActionOutputReg(unittest.TestCase):
|
|||||||
eq_(self.len_['val'], res.len)
|
eq_(self.len_['val'], res.len)
|
||||||
eq_(self.vendor['val'], res.vendor)
|
eq_(self.vendor['val'], res.vendor)
|
||||||
eq_(self.subtype['val'], res.subtype)
|
eq_(self.subtype['val'], res.subtype)
|
||||||
eq_(self.ofs_nbits['val'], res.ofs_nbits)
|
eq_(self.start, self.c.start)
|
||||||
|
eq_(self.end, self.c.end)
|
||||||
eq_(self.src['val'], res.src)
|
eq_(self.src['val'], res.src)
|
||||||
eq_(self.max_len['val'], res.max_len)
|
eq_(self.max_len['val'], res.max_len)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user