def h3c_messages(request): ''' 读取网页表格信息 ''' messages=[] rank=request.GET.get("rank") rankid=request.GET.get("rankid") id=request.GET.get("id") data = models.Message.objects.get(id=id) obj=GetRank(rank).get(id=rankid) def setName(*names): for name in names: messages.append(name) return None if rank == '2': setName(obj.name,obj.name,obj.name) elif rank == '2.5': setName(obj.parent_rank.name,obj.parent_rank.name,obj.name) elif rank == "3": if obj.parent_rank is not None: setName(obj.parent_rank.name,obj.parent_rank.name,obj.name) else: setName(obj.parent_rank_half.parent_rank.name,obj.parent_rank_half.name,obj.name) elif rank == '4': if obj.parent_rank.parent_rank is not None: setName(obj.parent_rank.parent_rank.name,obj.parent_rank.name,obj.name) else: setName(obj.parent_rank.parent_rank_half.name,obj.parent_rank.name,obj.name) #线路类型 messages.append(data.circuit) #设备类型 messages.append(data.IAD) #内网段 messages.append(data.intranetDiagram) #内网网关 messages.append(data.intranetGATEWAY) #ike-local-name messages.append(data.peerID) #公网地址 messages.append(data.PublicIP) #所在地DNS messages.append(data.DNS) #tunnelIP0 messages.append(data.Tunnel0) #tunnelIP1 messages.append(data.Tunnel1) #gre key messages.append(data.grekey) #ike-pre-share-key messages.append(data.ike_preshare_key) #password messages.append(data.currentPassword) #1000f ike peer 318的policy name # # 分公司(拼音)-机构(拼音)-grekey first = "" second = "" third = data.grekey policy_name = "" first = get_short_cut(convert(messages[0])) second = get_short_cut(convert(messages[1])) try: policy_name = first+"-"+second+"-"+str(third) except: policy_name = first+"-"+second+"-"+"???" messages.append(policy_name) return messages
def junniper_messages(request): ''' 读取网页表格信息 ''' messages=[] rank=request.GET.get("rank") rankid=request.GET.get("rankid") id=request.GET.get("id") data = models.Message.objects.get(id=id) obj=GetRank(rank).get(id=rankid) def setName(*names): for name in names: messages.append(name) return None # 设置 分公司 机构 分支机构名称 if rank == '2': setName(obj.name,obj.name,obj.name) elif rank == '2.5': setName(obj.parent_rank.name,obj.parent_rank.name,obj.name) elif rank == "3": if obj.parent_rank is not None: setName(obj.parent_rank.name,obj.parent_rank.name,obj.name) else: setName(obj.parent_rank_half.parent_rank.name,obj.parent_rank_half.name,obj.name) elif rank == '4': if obj.parent_rank.parent_rank is not None: setName(obj.parent_rank.parent_rank.name,obj.parent_rank.name,obj.name) else: setName(obj.parent_rank.parent_rank_half.name,obj.parent_rank.name,obj.name) #线路类型 messages.append(data.circuit) #设备类型 messages.append(data.IAD) #内网段 messages.append(data.intranetDiagram) #内网网关 messages.append(data.intranetGATEWAY) #本地端ID first = " ".join(convert(messages[0])).title().replace(" ","") second = " " .join(convert(messages[1])).title().replace(" ","") third = " ".join(convert(messages[2])).title().replace(" ","") local_id = first+"-"+second+"-"+third messages.append(local_id) #公网地址 messages.append(data.PublicIP) #所在地DNS messages.append(data.DNS) #预共享密钥(PSK) messages.append(data.PSK) #密码 messages.append(data.currentPassword) #安全提议名称???? first = get_short_cut(convert(messages[0])) second = get_short_cut(convert(messages[1])) third = data.grekey messages.append(first+"-"+second+"-"+third) #对端地址????? messages.append('219.131.174.199') #identify data 对端ID??????? messages.append('XXZX-SSG520') return messages