Exemple #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
Exemple #2
0
 def get_acct_output_gigawords(self):
     try:
         return tools.DecodeInteger(self.get(53)[0]) or 0
     except:
         return 0
Exemple #3
0
 def get_acct_terminate_cause(self):
     try:
         return tools.DecodeInteger(self.get(49)[0]) or 0
     except:
         return 0
Exemple #4
0
 def get_acct_output_packets(self):
     try:
         return tools.DecodeInteger(self.get(48)[0]) or 0
     except:
         return 0
Exemple #5
0
 def get_acct_sessiontime(self):
     try:
         return tools.DecodeInteger(self.get(46)[0]) or 0
     except:
         return 0
Exemple #6
0
 def get_acct_input_octets(self):
     try:
         return tools.DecodeInteger(self.get(42)[0]) or 0
     except:
         return 0
Exemple #7
0
 def get_acct_status_type(self):
     try:
         return tools.DecodeInteger(self.get(40)[0])
     except:
         return None
Exemple #8
0
 def get_acctinputoctets(self):
     try:
         return tools.DecodeInteger(self.get(42)[0])
     except:
         return None
Exemple #9
0
 def get_service_type(self):
     try:
         return tools.DecodeInteger(self.get(0)[0]) or 0
     except:
         return 0
Exemple #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]))
Exemple #11
0
 def get_nasporttype(self):
     try:
         return tools.DecodeInteger(self.get(61)[0])
     except:
         return None
Exemple #12
0
 def get_acctoutputgigawords(self):
     try:
         return tools.DecodeInteger(self.get(53)[0])
     except:
         return None
Exemple #13
0
 def get_acctterminatecause(self):
     try:
         return tools.DecodeInteger(self.get(49)[0])
     except:
         return None
Exemple #14
0
 def get_acctoutputpackets(self):
     try:
         return tools.DecodeInteger(self.get(48)[0])
     except:
         return None
Exemple #15
0
 def get_nas_port_type(self):
     try:
         return tools.DecodeInteger(self.get(61)[0]) or 0
     except:
         return 0
Exemple #16
0
 def testIntegerDecoding(self):
     self.assertEqual(tools.DecodeInteger(six.b('\x01\x02\x03\x04')),
                      0x01020304)
Exemple #17
0
 def get_session_timeout(self):
     try:
         return tools.DecodeInteger(self.get(27)[0]) or 0
     except:
         return 0