当前位置: 首页>>代码示例>>Python>>正文


Python Pool.description方法代码示例

本文整理汇总了Python中pynipap.Pool.description方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.description方法的具体用法?Python Pool.description怎么用?Python Pool.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pynipap.Pool的用法示例。


在下文中一共展示了Pool.description方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_pool

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]
    def add_pool(self):
        """ Add a pool.
        """

        # extract attributes
        p = Pool()
        if 'name' in request.json:
            p.name = validate_string(request.json, 'name')
        if 'description' in request.json:
            p.description = validate_string(request.json, 'description')
        if 'default_type' in request.json:
            p.default_type = validate_string(request.json, 'default_type')
        # TODO: handle integers
        if 'ipv4_default_prefix_length' in request.json:
            p.ipv4_default_prefix_length = request.json['ipv4_default_prefix_length']
        if 'ipv6_default_prefix_length' in request.json:
            p.ipv6_default_prefix_length = request.json['ipv6_default_prefix_length']
        if 'tags' in request.json:
            p.tags = request.json['tags']
        if 'avps' in request.json:
            p.avps = request.json['avps']

        try:
           p.save()
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
开发者ID:fredsod,项目名称:NIPAP,代码行数:28,代码来源:xhr.py

示例2: add

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]
    def add(self):
        """ Add a pool.
        """

        if 'schema' not in request.params:
            redirect(url(controller = 'schema', action = 'list'))
        c.schema = Schema.get(int(request.params['schema']))

        # Adding to NIPAP
        if request.method == 'POST':
            p = Pool()
            p.schema = c.schema
            p.name = request.params.get('name')
            p.description = request.params.get('description')
            p.default_type = request.params.get('default_type')

            if request.params['ipv4_default_prefix_length'].strip() != '':
                p.ipv4_default_prefix_length = request.params['ipv4_default_prefix_length']

            if request.params['ipv6_default_prefix_length'].strip() != '':
                p.ipv6_default_prefix_length = request.params['ipv6_default_prefix_length']

            p.save()
            redirect(url(controller = 'pool', action = 'list', schema = c.schema.id))

        return render("/pool_add.html")
开发者ID:tobbakko,项目名称:NIPAP,代码行数:28,代码来源:pool.py

示例3: add_pool

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]
def add_pool(arg, opts):
    """ Add a pool.
    """

    p = Pool()
    p.schema = get_schema(opts.get('schema'))
    p.name = opts.get('name')
    p.description = opts.get('description')
    p.default_type = opts.get('default-type')
    p.ipv4_default_prefix_length = opts.get('ipv4_default_prefix_length')
    p.ipv6_default_prefix_length = opts.get('ipv6_default_prefix_length')

    try:
        p.save()
    except pynipap.NipapError, e:
        print >> sys.stderr, "Could not add pool to NIPAP: %s" % e.message
        sys.exit(1)
开发者ID:tobbakko,项目名称:NIPAP,代码行数:19,代码来源:nipap_cli.py

示例4: add_pool

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]
    def add_pool(self):
        """ Add a pool.
        """

        # extract attributes
        p = Pool()
        p.name = request.params.get('name')
        p.description = request.params.get('description')
        p.default_type = request.params.get('default_type')
        if 'ipv4_default_prefix_length' in request.params:
            if request.params['ipv4_default_prefix_length'].strip() != '':
                p.ipv4_default_prefix_length = request.params['ipv4_default_prefix_length']
        if 'ipv6_default_prefix_length' in request.params:
            if request.params['ipv6_default_prefix_length'].strip() != '':
                p.ipv6_default_prefix_length = request.params['ipv6_default_prefix_length']

        try:
           p.save()
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
开发者ID:sohonet,项目名称:NIPAP,代码行数:22,代码来源:xhr.py

示例5: Pool

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]
    # set up pynipap
    aopts = pynipap.AuthOptions({ 'authoritative_source': 'nipap' })
    pynipap.xmlrpc_uri = nipapd_xmlrpc_uri


    #
    # Create pools
    #
    print "Creating pools... ",
    sql = "SELECT * FROM ip_net_pool"
    curs_pg_old.execute(sql)
    pools = {}
    for r in curs_pg_old:
        p = Pool()
        p.name = r['name']
        p.description = r['description']
        p.default_type = r['default_type']
        p.ipv4_default_prefix_length = r['ipv4_default_prefix_length']
        p.ipv6_default_prefix_length = r['ipv6_default_prefix_length']
        try:
            p.save()
        except NipapError, e:
            print "ERR: %s" % str(e)
        pools[r['id']] = p

        # remove new audit log entries
        sql = "DELETE FROM ip_net_log WHERE pool_id = %s"
        curs_pg_new.execute(sql, ( p.id, ))

        # fetch old audit log entries
        sql = "SELECT * FROM ip_net_log WHERE pool = %s AND prefix IS NULL"
开发者ID:Cougar,项目名称:NIPAP,代码行数:33,代码来源:convert.py

示例6: add_pool

# 需要导入模块: from pynipap import Pool [as 别名]
# 或者: from pynipap.Pool import description [as 别名]

    def add_pool(self):
        """ Add a pool.
        """

        try:
            c.schema = Schema.get(int(request.params.get('schema')))
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        # extract attributes
        p = Pool()
        p.schema = c.schema
        p.name = request.params.get('name')
        p.description = request.params.get('description')
        p.default_type = request.params.get('default_type')
        if 'ipv4_default_prefix_length' in request.params:
            if request.params['ipv4_default_prefix_length'].strip() != '':
                p.ipv4_default_prefix_length = request.params['ipv4_default_prefix_length']
        if 'ipv6_default_prefix_length' in request.params:
            if request.params['ipv6_default_prefix_length'].strip() != '':
                p.ipv6_default_prefix_length = request.params['ipv6_default_prefix_length']

        try:
           p.save()
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        return json.dumps(p, cls=NipapJSONEncoder)
开发者ID:tobbakko,项目名称:NIPAP,代码行数:31,代码来源:xhr.py


注:本文中的pynipap.Pool.description方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。