예제 #1
0
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"
)


@permit.route(r"/api/v1/product/add")
class ProductAddHandler(ApiHandler):

    def get(self):
        self.post()
예제 #2
0
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"用户地址"),
                                   dataform.Item("customer_name",
                                                 description=u"客户自助服务账号"),
                                   dataform.Item("account_number",
                                                 rules.not_null,
                                                 description=u"用户认证账号"),
                                   dataform.Item("product_id",
                                                 rules.not_null,
                                                 description=u"资费id"),
                                   dataform.Item("password",
                                                 rules.not_null,
                                                 description=u"用户密码"),
                                   dataform.Item("begin_date",
                                                 rules.is_date,
                                                 description=u"开通日期"),
                                   dataform.Item("expire_date",
                                                 rules.is_date,
                                                 description=u"过期日期"),
                                   dataform.Item("balance",
                                                 rules.is_rmb,
                                                 description=u"用户余额"),
                                   dataform.Item("fee_value",
                                                 rules.is_rmb,
                                                 description=u"用户缴费金额"),
                                   dataform.Item("time_length",
                                                 rules.is_number,
                                                 default='0',
                                                 description=u"用户时长"),
                                   dataform.Item("flow_length",
                                                 rules.is_number,
                                                 default='0',
                                                 description=u"用户流量"),
                                   dataform.Item("bind_mac",
                                                 description=u"用户是否绑定 MAC"),
                                   dataform.Item("bind_vlan",
                                                 description=u"用户是否绑定 vlan"),
                                   dataform.Item("concur_number",
                                                 description=u"用户并发数"),
                                   dataform.Item("ip_address",
                                                 description=u"用户IP地址"),
                                   dataform.Item("input_max_limit",
                                                 description=u"用户上行速度 Mbps"),
                                   dataform.Item("output_max_limit",
                                                 description=u"用户下行速度 Mbps"),
                                   dataform.Item("free_bill_type",
                                                 description=u"用户计费类型"),
                                   title="api customer add")
예제 #3
0
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"授权端口",
                                            default=3799),
                              dataform.Item("time_type",
                                            description=u"时间类型",
                                            default=0),
                              title="api nas add")


@permit.route(r"/api/v1/nas/add")
class NasAddHandler(ApiHandler):
예제 #4
0
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"用户密码"),
                                      dataform.Item("begin_date",
                                                    rules.is_date,
                                                    description=u"开通日期"),
                                      dataform.Item("expire_date",
                                                    rules.is_date,
                                                    description=u"过期日期"),
                                      dataform.Item("balance",
                                                    rules.is_rmb,
                                                    description=u"用户余额"),
                                      dataform.Item("time_length",
                                                    description=u"用户时长"),
                                      dataform.Item("flow_length",
                                                    description=u"用户流量"),
                                      title="import")
예제 #5
0
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")
class ProductUpdateHandler(ApiHandler):
    """ @param: 
        product_id: str
    """
    def get(self):
예제 #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
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"用户地址"),
                                   dataform.Item("customer_name",
                                                 description=u"客户自助服务账号"),
                                   dataform.Item("account_number",
                                                 rules.not_null,
                                                 description=u"用户认证账号"),
                                   dataform.Item("product_id",
                                                 rules.not_null,
                                                 description=u"资费id"),
                                   dataform.Item("password",
                                                 rules.not_null,
                                                 description=u"用户密码"),
                                   dataform.Item("begin_date",
                                                 rules.is_date,
                                                 description=u"开通日期"),
                                   dataform.Item("expire_date",
                                                 rules.is_date,
                                                 description=u"过期日期"),
                                   dataform.Item("balance",
                                                 rules.is_rmb,
                                                 description=u"用户余额"),
                                   dataform.Item("time_length",
                                                 description=u"用户时长"),
                                   dataform.Item("flow_length",
                                                 description=u"用户流量"),
                                   title="api customer add")
예제 #8
0
from toughlib import utils, apiutils, dispatch
from toughlib.permit import permit
from toughradius.manage.api.apibase import ApiHandler
from toughradius.manage import models
from toughlib.btforms import dataform
from toughlib.btforms import rules

nas_update_vform = dataform.Form(dataform.Item("dns_name",
                                               rules.len_of(0, 128),
                                               description=u"DNS域名"),
                                 dataform.Item("bas_name",
                                               rules.len_of(0, 64),
                                               description=u"接入设备名称",
                                               default=u"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"授权端口",
                                               default=3799),
                                 title="api nas update")


@permit.route(r"/api/v1/nas/update")
class NasUpdateHandler(ApiHandler):
    def get(self):
        self.post()