コード例 #1
0
#!/usr/bin/env python
#coding=utf-8
import time
import traceback
from toughlib import utils, apiutils, dispatch
from toughlib.btforms import dataform
from toughlib.btforms import rules
from toughlib.apiutils import apistatus
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models

nas_add_vform = dataform.Form(dataform.Item("ip_addr",
                                            rules.is_ip,
                                            description=u"接入设备地址"),
                              dataform.Item("dns_name",
                                            rules.len_of(0, 128),
                                            description=u"DNS域名"),
                              dataform.Item("bas_name",
                                            rules.len_of(0, 64),
                                            description=u"接入设备名称",
                                            default="new bas"),
                              dataform.Item("bas_secret",
                                            rules.is_alphanum2(4, 32),
                                            description=u"共享秘钥"),
                              dataform.Item("vendor_id",
                                            description=u"接入设备类型",
                                            default=0),
                              dataform.Item("coa_port",
                                            rules.is_number,
                                            description=u"授权端口",
コード例 #2
0
ファイル: api_product_add.py プロジェクト: sumonchai/tough
#!/usr/bin/env python
# coding=utf-8

from toughlib.btforms import dataform
from toughlib.btforms import rules
from toughlib import utils, apiutils, dispatch
from toughlib.permit import permit
import datetime
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models

""" 添加产品套餐
"""
product_add_vform = dataform.Form(
    dataform.Item("product_name", rules.len_of(4, 64), description=u"资费名称"),
    dataform.Item("product_policy", description=u"计费策略"),
    dataform.Item("fee_months", rules.is_number, description=u"买断授权月数"),
    dataform.Item("fee_times", rules.is_number3, description=u"买断时长(小时)"),
    dataform.Item("fee_flows", rules.is_number3, description=u"买断流量(MB)"),
    dataform.Item("fee_price", rules.is_rmb, description=u"资费价格(元)"),
    # dataform.Hidden("fee_period", rules.is_period, description=u"开放认证时段", **input_style),
    dataform.Item("concur_number", rules.is_numberOboveZore, description=u"并发数控制(0表示不限制)"),
    dataform.Item("bind_mac", description=u"是否绑定MAC "),
    dataform.Item("bind_vlan", description=u"是否绑定VLAN "),
    dataform.Item("input_max_limit", rules.is_number3, description=u"最大上行速率(Mbps)"),
    dataform.Item("output_max_limit", rules.is_number3, description=u"最大下行速率(Mbps)"),
    dataform.Item("product_status", description=u"资费状态"),
    title="api product add"
)

コード例 #3
0
import time
import traceback
import decimal
from toughlib.btforms import dataform
from toughlib.btforms import rules
from toughlib import utils, apiutils, dispatch
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models
from toughradius.manage.settings import *
from hashlib import md5
""" 客户新开户
"""

customer_add_vform = dataform.Form(dataform.Item("realname",
                                                 rules.not_null,
                                                 description=u"用户姓名"),
                                   dataform.Item("node_id",
                                                 rules.not_null,
                                                 description=u"区域id"),
                                   dataform.Item("idcard",
                                                 rules.len_of(0, 32),
                                                 description=u"证件号码"),
                                   dataform.Item("mobile",
                                                 rules.len_of(0, 32),
                                                 description=u"用户手机号码"),
                                   dataform.Item("email",
                                                 rules.is_email,
                                                 description=u"用户Email"),
                                   dataform.Item("address",
                                                 description=u"用户地址"),
コード例 #4
0
                                         required="required",
                                         **input_style),
                        btforms.File("import_file",
                                     description=u"用户数据文件",
                                     required="required",
                                     **input_style),
                        btforms.Button("submit",
                                       type="submit",
                                       html=u"<b>立即导入</b>",
                                       **button_style),
                        title=u"用户数据导入",
                        action="/admin/customer/import")


customer_import_vform = dataform.Form(dataform.Item("realname",
                                                    rules.not_null,
                                                    description=u"用户姓名"),
                                      dataform.Item("idcard",
                                                    rules.len_of(0, 32),
                                                    description=u"证件号码"),
                                      dataform.Item("mobile",
                                                    rules.len_of(0, 32),
                                                    description=u"用户手机号码"),
                                      dataform.Item("address",
                                                    description=u"用户地址"),
                                      dataform.Item("account_number",
                                                    rules.not_null,
                                                    description=u"用户账号"),
                                      dataform.Item("password",
                                                    rules.not_null,
                                                    description=u"用户密码"),
コード例 #5
0
#!/usr/bin/env python
#coding=utf-8

from toughlib.btforms import rules
from toughlib.btforms import dataform
from toughlib import utils
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models
""" 产品套餐修改
"""

product_update_vform = dataform.Form(
    dataform.Item("product_name", rules.len_of(4, 64), description=u"资费名称"),
    dataform.Item("fee_price", rules.is_rmb, description=u"资费价格(元)"),
    dataform.Item("concur_number",
                  rules.is_numberOboveZore,
                  description=u"并发数控制(0表示不限制)"),
    dataform.Item("bind_mac", description=u"是否绑定MAC "),
    dataform.Item("bind_vlan", description=u"是否绑定VLAN "),
    dataform.Item("input_max_limit",
                  rules.is_number3,
                  description=u"最大上行速率(Mbps)"),
    dataform.Item("output_max_limit",
                  rules.is_number3,
                  description=u"最大下行速率(Mbps)"),
    dataform.Item("product_status", description=u"资费状态"),
    title="api product update")


@permit.route(r"/api/v1/product/update")
コード例 #6
0
#!/usr/bin/env python
#coding=utf-8

from toughlib.btforms import dataform
from toughlib.btforms import rules
from toughlib import utils, apiutils, dispatch
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models

""" 添加区域节点
"""

node_add_vform = dataform.Form(
    dataform.Item("node_name", rules.len_of(2, 32), description=u"区域名称"),
    dataform.Item("node_desc", rules.len_of(2, 128), description=u"区域描述"),
    title=u"node add",
)

@permit.route(r"/api/v1/node/add")
class NodeAddHandler(ApiHandler):
    """ @param: 
        form
    """

    def get(self):
        self.post()

    def post(self):
        form = node_add_vform()
        try:
コード例 #7
0
#coding=utf-8
import time
import traceback
from toughlib.btforms import dataform
from toughlib.btforms import rules
from toughlib import utils, apiutils, dispatch
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models
from toughradius.manage.settings import *
from hashlib import md5
""" 客户新开户
"""

customer_add_vform = dataform.Form(dataform.Item("realname",
                                                 rules.not_null,
                                                 description=u"用户姓名"),
                                   dataform.Item("node_id",
                                                 rules.not_null,
                                                 description=u"区域id"),
                                   dataform.Item("idcard",
                                                 rules.len_of(0, 32),
                                                 description=u"证件号码"),
                                   dataform.Item("mobile",
                                                 rules.len_of(0, 32),
                                                 description=u"用户手机号码"),
                                   dataform.Item("email",
                                                 rules.is_email,
                                                 description=u"用户Email"),
                                   dataform.Item("address",
                                                 description=u"用户地址"),