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


Python Vlan.edit_vlan方法代码示例

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


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

示例1: handle_post

# 需要导入模块: from networkapi.vlan.models import Vlan [as 别名]
# 或者: from networkapi.vlan.models.Vlan import edit_vlan [as 别名]

#.........这里部分代码省略.........
                            None, 'acl_file_v6', acl_file_v6)

                    # VERIFICA SE VLAN COM MESMO ACL JA EXISTE OU NAO
                    vlan.get_vlan_by_acl_v6(acl_file_v6)

                ambiente = Ambiente()
                ambiente = ambiente.get_by_pk(environment_id)

                change_name = False
                change_number_environment = False

                redes4 = vlan.networkipv4_set.all()
                redes6 = vlan.networkipv6_set.all()

                listaIpsv4 = []
                listaIpsv6 = []

                listaEquips4 = []
                listaEquips6 = []

                for rede in redes4:
                    for ip in rede.ip_set.all():
                        listaIpsv4.append(ip)

                for rede in redes6:
                    for ip in rede.ipv6_set.all():
                        listaIpsv6.append(ip)

                for ip in listaIpsv4:
                    for ipequip in ip.ipequipamento_set.all():
                        listaEquips4.append(ipequip.equipamento)

                for ip in listaIpsv6:
                    for ipequip in ip.ipv6equipament_set.all():
                        listaEquips6.append(ipequip.equipamento)

                listaDeIps4DoEquip = []
                listaDeIps6DoEquip = []
                listaDeVlansDoEquip = []

                for equip in listaEquips4:
                    for ipequip in equip.ipequipamento_set.all():
                        ip_aux = ipequip.ip
                        if ip_aux not in listaDeIps4DoEquip:
                            listaDeIps4DoEquip.append(ip_aux)

                for equip in listaEquips6:
                    for ipequip in equip.ipv6equipament_set.all():
                        ip_aux = ipequip.ip
                        if ip_aux not in listaDeIps4DoEquip:
                            listaDeIps6DoEquip.append(ip_aux)

                for ip in listaDeIps4DoEquip:
                    vlan_aux = ip.networkipv4.vlan
                    if vlan_aux not in listaDeVlansDoEquip:
                        listaDeVlansDoEquip.append(vlan_aux)

                for ip in listaDeIps6DoEquip:
                    vlan_aux = ip.networkipv6.vlan
                    if vlan_aux not in listaDeVlansDoEquip:
                        listaDeVlansDoEquip.append(vlan_aux)

                if vlan.nome != name:
                    change_name = True
                    vlan.nome = name
                if int(vlan.num_vlan) != int(number) or int(vlan.ambiente.id) != int(environment_id):
                    change_number_environment = True
                    vlan.num_vlan = number
                    vlan.ambiente = ambiente

                vlan.acl_file_name = acl_file
                vlan.acl_file_name_v6 = acl_file_v6
                vlan.descricao = description

                vlan_id_cache = [id_vlan]
                # Delete vlan's cache
                destroy_cache_function(vlan_id_cache)

                # Delete equipment's cache
                equip_id_list = []

                for netv4 in vlan.networkipv4_set.all():
                    for ip in netv4.ip_set.all():
                        for ip_equip in ip.ipequipamento_set.all():
                            equip_id_list.append(ip_equip.equipamento_id)

                for netv6 in vlan.networkipv6_set.all():
                    for ip in netv6.ipv6_set.all():
                        for ip_equip in ip.ipv6equipament_set.all():
                            equip_id_list.append(ip_equip.equipamento_id)

                destroy_cache_function(equip_id_list, True)

                vlan.edit_vlan(user, change_name, change_number_environment)
                # Return XML

                return self.response(dumps_networkapi({}))

        except VlanACLDuplicatedError, e:
            return self.response_error(311, acl_file)
开发者ID:itnihao,项目名称:GloboNetworkAPI,代码行数:104,代码来源:VlanEditResource.py


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