示例#1
0
def bas_add_form(isps=[]):
    return btforms.Form(btforms.Dropdown("isp_code",
                                         isps,
                                         description=u"服务商",
                                         required="required",
                                         **input_style),
                        btforms.Textbox("ip_addr",
                                        rules.is_ip,
                                        description=u"设备地址",
                                        required="required",
                                        **input_style),
                        btforms.Textbox("bas_name",
                                        rules.len_of(2, 64),
                                        description=u"设备名称",
                                        required="required",
                                        **input_style),
                        btforms.Textbox("dns_name",
                                        rules.len_of(1, 128),
                                        description=u"DNS域名",
                                        help=u"动态IP专用",
                                        **input_style),
                        btforms.Textbox("bas_secret",
                                        rules.is_alphanum2(4, 32),
                                        description=u"共享秘钥",
                                        required="required",
                                        **input_style),
                        btforms.Dropdown("vendor_id",
                                         description=u"设备类型",
                                         args=bastype.items(),
                                         required="required",
                                         **input_style),
                        btforms.Dropdown("portal_vendor",
                                         description=u"portal协议",
                                         args=portaltype.items(),
                                         required="required",
                                         **input_style),
                        btforms.Dropdown("time_type",
                                         description=u"时区类型",
                                         args=timetype.items(),
                                         required="required",
                                         **input_style),
                        btforms.Textbox("ac_port",
                                        rules.is_number,
                                        description=u"AC端口",
                                        default=2000,
                                        required="required",
                                        **input_style),
                        btforms.Textbox("coa_port",
                                        rules.is_number,
                                        description=u"CoA端口",
                                        default=3799,
                                        required="required",
                                        **input_style),
                        btforms.Button("submit",
                                       type="submit",
                                       html=u"<b>提交</b>",
                                       **button_style),
                        title=u"增加接入设备",
                        action="/bas/add")
示例#2
0
def domain_add_vform(tpls=[]):
    return btforms.Form(
        btforms.Dropdown("tpl_name", tpls, rules.not_null, description=u"模版", required="required", **input_style),
        btforms.Textbox("domain_code", rules.is_alphanum2(2,16), description=u"域编码",required="required", **input_style),
        btforms.Textbox("domain_desc", rules.not_null, description=u"域描述",required="required", **input_style),
        btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
        title=u"增加域属性",
        action="/domain/add"
    )
示例#3
0
def domain_add_vform(tpls=[],isps=[]):
    return btforms.Form(
        btforms.Dropdown("isp_code", isps, description=u"服务商", required="required", **input_style),
        btforms.Dropdown("tpl_name", tpls, rules.not_null, description=u"模版", required="required", **input_style),
        btforms.Textbox("domain_code", rules.is_alphanum2(2,16), description=u"域编码",required="required", **input_style),
        btforms.Textbox("domain_desc", rules.not_null, description=u"域描述",required="required", **input_style),
        btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
        title=u"增加域属性",
        action="/domain/add"
    )
示例#4
0
def bas_add_form(isps=[]):
    return btforms.Form(
        btforms.Dropdown("isp_code", isps, description=u"服务商", required="required", **input_style),
        btforms.Textbox("ip_addr", rules.is_ip, description=u"设备地址", required="required", **input_style),
        btforms.Textbox("bas_name", rules.len_of(2, 64), description=u"设备名称", required="required", **input_style),
        btforms.Textbox("dns_name", rules.len_of(1, 128), description=u"DNS域名", help=u"动态IP专用", **input_style),
        btforms.Textbox("bas_secret", rules.is_alphanum2(4, 32), description=u"共享秘钥", required="required", **input_style),
        btforms.Dropdown("vendor_id", description=u"设备类型", args=bastype.items(), required="required", **input_style),
        btforms.Dropdown("portal_vendor", description=u"portal协议", args=portaltype.items(), required="required", **input_style),
        btforms.Dropdown("time_type", description=u"时区类型", args=timetype.items(), required="required", **input_style),
        btforms.Textbox("ac_port", rules.is_number, description=u"AC端口", default=2000, required="required",**input_style),
        btforms.Textbox("coa_port", rules.is_number, description=u"CoA端口", default=3799, required="required",**input_style),
        btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
        title=u"增加接入设备",
        action="/bas/add"
    )
示例#5
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")
示例#6
0
bastype = {
    '0': u'标准',
    '3041': u'阿尔卡特',
    '2352': u'爱立信',
    '2011': u'华为',
    '25506': u'H3C',
    '3902': u'中兴',
    '10055': u'爱快',
    '14988': u'RouterOS'
}

bas_add_form = btforms.Form(
    btforms.Textbox("ip_addr", rules.is_ip, description=u"接入设备地址",  **input_style),
    btforms.Textbox("dns_name", rules.len_of(1, 128), description=u"DNS域名", help=u"动态IP专用", **input_style),
    btforms.Textbox("bas_name", rules.len_of(2, 64), description=u"接入设备名称", required="required", **input_style),
    btforms.Textbox("bas_secret", rules.is_alphanum2(4, 32), description=u"共享秘钥", required="required", **input_style),
    btforms.Dropdown("vendor_id", description=u"接入设备类型", args=bastype.items(), required="required", **input_style),
    btforms.Textbox("coa_port", rules.is_number, description=u"授权端口", default=3799, required="required",**input_style),
    btforms.Dropdown("time_type", description=u"时间类型", args=timetype.items(), required="required", **input_style),
    btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style),
    title=u"增加接入设备",
    action="/admin/bas/add"
)

bas_update_form = btforms.Form(
    btforms.Hidden("id", description=u"编号"),
    btforms.Textbox("dns_name", rules.len_of(1, 128), description=u"DNS域名", help=u"动态IP专用", **input_style),
    btforms.Textbox("ip_addr", rules.is_ip, description=u"接入设备地址",  **input_style),
    btforms.Textbox("bas_name", rules.len_of(2, 64), description=u"接入设备名称", required="required", **input_style),
    btforms.Textbox("bas_secret", rules.is_alphanum2(4, 32), description=u"共享秘钥", required="required", **input_style),
    btforms.Dropdown("vendor_id", description=u"接入设备类型", args=bastype.items(), required="required", **input_style),