예제 #1
0
 def get_acctstatustype(self):
     try:
         return tools.DecodeInteger(self.get(40)[0])
     except:
         if is_debug():
             exception(
                 'Exception while trying to get nas accounting status')
         return None
예제 #2
0
 def get_acct_output_gigawords(self):
     try:
         return tools.DecodeInteger(self.get(53)[0]) or 0
     except:
         return 0
예제 #3
0
 def get_acct_terminate_cause(self):
     try:
         return tools.DecodeInteger(self.get(49)[0]) or 0
     except:
         return 0
예제 #4
0
 def get_acct_output_packets(self):
     try:
         return tools.DecodeInteger(self.get(48)[0]) or 0
     except:
         return 0
예제 #5
0
 def get_acct_sessiontime(self):
     try:
         return tools.DecodeInteger(self.get(46)[0]) or 0
     except:
         return 0
예제 #6
0
 def get_acct_input_octets(self):
     try:
         return tools.DecodeInteger(self.get(42)[0]) or 0
     except:
         return 0
예제 #7
0
 def get_acct_status_type(self):
     try:
         return tools.DecodeInteger(self.get(40)[0])
     except:
         return None
예제 #8
0
파일: utils.py 프로젝트: simudream/PyRadius
 def get_acctinputoctets(self):
     try:
         return tools.DecodeInteger(self.get(42)[0])
     except:
         return None
예제 #9
0
 def get_service_type(self):
     try:
         return tools.DecodeInteger(self.get(0)[0]) or 0
     except:
         return 0
예제 #10
0
d = dictionary.Dictionary(*dicts)

for oid, name in d.vendors.backward.items():
    if oid != 0:
        const_vendor.append((oid, name))

for k in d.attributes:
    attr = d.attributes[k]
    oid = d.vendors[attr.vendor]
    key = makeKey(oid, attr.code)

    if attr.type == 'integer':
        for vname, value in attr.values.forward.items():
            newName = attr.name.replace('-', '') + '_' + vname.replace(
                '-', '').replace('.', '')
            const_value.append((key, tools.DecodeInteger(value), newName))

    newName = 'Attr' + attr.name.replace('-', '')
    output.append((key,
                   tmpl.format(name=attr.name,
                               oid=oid,
                               code=attr.code,
                               tag='true' if attr.has_tag else 'false',
                               encrypt=attr.encrypt,
                               type=attrMap.get(attr.type,
                                                'AttributeUnknown')),
                   "%s AttributeKey = %s" % (newName, key)))

output = sorted(output, key=lambda x: x[0])
const_vendor = sorted(const_vendor, key=lambda x: x[0])
const_value = sorted(const_value, key=lambda x: (x[0], x[1]))
예제 #11
0
파일: utils.py 프로젝트: simudream/PyRadius
 def get_nasporttype(self):
     try:
         return tools.DecodeInteger(self.get(61)[0])
     except:
         return None
예제 #12
0
파일: utils.py 프로젝트: simudream/PyRadius
 def get_acctoutputgigawords(self):
     try:
         return tools.DecodeInteger(self.get(53)[0])
     except:
         return None
예제 #13
0
파일: utils.py 프로젝트: simudream/PyRadius
 def get_acctterminatecause(self):
     try:
         return tools.DecodeInteger(self.get(49)[0])
     except:
         return None
예제 #14
0
파일: utils.py 프로젝트: simudream/PyRadius
 def get_acctoutputpackets(self):
     try:
         return tools.DecodeInteger(self.get(48)[0])
     except:
         return None
예제 #15
0
 def get_nas_port_type(self):
     try:
         return tools.DecodeInteger(self.get(61)[0]) or 0
     except:
         return 0
예제 #16
0
 def testIntegerDecoding(self):
     self.assertEqual(tools.DecodeInteger(six.b('\x01\x02\x03\x04')),
                      0x01020304)
예제 #17
0
 def get_session_timeout(self):
     try:
         return tools.DecodeInteger(self.get(27)[0]) or 0
     except:
         return 0