def test_hello(self): obj = ofp.message.hello( xid=0x12345678, elements=[ ofp.hello_elem_versionbitmap( bitmaps=[ofp.uint32(1), ofp.uint32(2)]), ofp.hello_elem_versionbitmap( bitmaps=[ofp.uint32(3), ofp.uint32(4)])]) buf = ''.join([ '\x04', '\x00', # version, type '\x00\x20', # length '\x12\x34\x56\x78', # xid '\x00\x01', # elements[0].type '\x00\x0c', # elements[0].length '\x00\x00\x00\x01', # elements[0].bitmaps[0] '\x00\x00\x00\x02', # elements[0].bitmaps[1] '\x00\x01', # elements[1].type '\x00\x0c', # elements[1].length '\x00\x00\x00\x03', # elements[1].bitmaps[0] '\x00\x00\x00\x04', # elements[1].bitmaps[1] ]) test_serialization(obj, buf)
def test_hello_elem_versionbitmap_unpack(self): obj = ofp.hello_elem_versionbitmap.unpack(self.sample_hello_elem_buf) self.assertEquals(len(obj.bitmaps), 2) self.assertEquals(obj.bitmaps[0], ofp.uint32(0x01234567)) self.assertEquals(obj.bitmaps[1], ofp.uint32(0x89abcdef))
def test_hello_elem_versionbitmap_pack(self): obj = ofp.hello_elem_versionbitmap( bitmaps=[ofp.uint32(0x01234567), ofp.uint32(0x89abcdef)]) self.assertEquals(self.sample_hello_elem_buf, obj.pack())
def test_hello_elem_versionbitmap_pack(self): obj = ofp.hello_elem_versionbitmap(bitmaps=[ofp.uint32(0x01234567),ofp.uint32(0x89abcdef)]) self.assertEquals(self.sample_hello_elem_buf, obj.pack())