Example #1
0
def regread_expect(ifaceName, reg, exp, mask = 0xffffffff):
    val = hwReg.readReg(reg,ifaceName)
    if (val & mask) != (exp & mask):
        name = __main__.nf_regmap.get(reg, "unknown")
        print 'ERROR: Register read expected 0x%08x but found 0x%08x at address 0x%08x (%s)'%(exp, val, reg, name)
        if ifaceName not in badReads:
            badReads[ifaceName] = []
        badReads[ifaceName].append({'Expected':exp, 'Value':val, 'Register':reg, 'RegName':name})
    return val
Example #2
0
def read_table(index):
    writeReg(rd.MATCHER_READ_REG_REG(), index)
    time.sleep(2)

    vals, vals2, vals3= [], [], []
    for j in xrange(9):
        vals.append(readReg(rd.MATCHER_LUT_DATA_0_REG()+4*j))
        vals2.append(readReg(rd.MATCHER_TCAM_DATA_0_REG()+4*j))
        vals3.append(readReg(rd.MATCHER_TCAM_MASK_0_REG()+4*j))
    print [hex(x) for x in vals]
    print [hex(x) for x in vals2]
    print [hex(x) for x in vals3]
    tot = [vals, vals2, vals3]
    for k in xrange(3):
        mydata = struct.pack("I"*9, *tot[k])
        of_h = OFHeader(mydata)

        print [(x[0], of_h.pretty.get(x[0], -1)) for x in OF_STRUCT]
Example #3
0
def read_last_header():
    y = []
    for i in xrange(9):
        y.append(long(readReg(rd.HDR_LAST_HEADERS_SEEN_0_REG() + 4 * i)))
        print i, hex(y[len(y) - 1])

    s = struct.Struct(9 * 'L')
    mydata = s.pack(*y)
    of = OFHeader(mydata)
    return of
def read_last_header():
    y = []
    for i in xrange(9):
        y.append(long(readReg(rd.HDR_LAST_HEADERS_SEEN_0_REG() + 4*i)))
        print i, hex(y[len(y)-1])

    s = struct.Struct(9 * 'L')
    mydata = s.pack(*y)
    of = OFHeader(mydata)
    return of
Example #5
0
def regread_expect(reg, exp, mask=0xffffffff):
    val = hwReg.readReg(reg)
    if (val & mask) != (exp & mask):
        name = __main__.nf_regmap.get(reg, "unknown")
        print 'ERROR : Register read expected 0x%08x but found 0x%08x at address 0x%08x (%s)' % (
            exp, val, reg, name)
        if ifaceName not in badReads:
            badReads[ifaceName] = []
        badReads[ifaceName].append({
            'Expected': exp,
            'Value': val,
            'Register': reg,
            'RegName': name
        })
    return val
import struct
from hwReg import readReg
import reg_defines_openflow as rd
from of_header import OFHeader, OF_STRUCT
from socket import ntohl, ntohs, inet_aton, inet_ntoa

y = []
for i in xrange(9):
    y.append(long(readReg(rd.HDR_LAST_HEADERS_SEEN_0_REG() + 4*i)))
    print i, hex(y[len(y)-1])

s = struct.Struct(9 * 'L')
print s.size
mydata = s.pack(*y)
print [hex(x) for x in s.unpack(mydata)]

of = OFHeader(mydata)

print ""

for x in OF_STRUCT:
    print x[0], of.pretty.get(x[0], 0)
Example #7
0
def regread(reg):
#    if ifaceName.startswith('nf'):
	return hwReg.readReg(reg)
Example #8
0
def regread(reg):
	return hwReg.readReg(reg)
Example #9
0
def regread(reg):
#    if ifaceName.startswith('nf'):
	return hwReg.readReg(reg)
Example #10
0
def regread(ifaceName, reg):
    if ifaceName.startswith('nf2c'):
        return hwReg.readReg(reg,ifaceName)
Example #11
0
def regread(ifaceName, reg):
    if ifaceName.startswith('nf2c'):
        return hwReg.readReg(reg, ifaceName)
Example #12
0
import struct
from hwReg import readReg
import reg_defines_openflow as rd
from of_header import OFHeader, OF_STRUCT
from socket import ntohl, ntohs, inet_aton, inet_ntoa

y = []
for i in xrange(9):
    y.append(long(readReg(rd.HDR_LAST_HEADERS_SEEN_0_REG() + 4 * i)))
    print i, hex(y[len(y) - 1])

s = struct.Struct(9 * 'L')
print s.size
mydata = s.pack(*y)
print[hex(x) for x in s.unpack(mydata)]

of = OFHeader(mydata)

print ""

for x in OF_STRUCT:
    print x[0], of.pretty.get(x[0], 0)