'check openflow header fields in packed byte array'

def assert_packed_header(self, pack, ofp_type, length, xid):

    def assert_num(name, start, length, expected):
        val = extract_num(pack, start, length)
        self.assertEquals(val, expected, ('packed    header    check:    %s    for    ofp    type    %s    should    be    %d    (is    %d)' % (name, ofp_type_map[ofp_type], expected, val)))
    assert_num('OpenFlow    version', 0, 1, 1)
    assert_num('header_type', 1, 1, ofp_type)
    assert_num('length    in    header', 2, 2, length)
    assert_num('xid', 4, 4, xid)
