Exemplo n.º 1
0
 def getPortDataConfig(cls,pid):
     try:
         isIp = False if pid < 256 else Converter.intIp2string(pid)
         searchName = 'slan0'+str(pid) if not isIp else cls._portNameByIP(isIp)
         ostPortInfo = list(filter(lambda ostPrt: searchName in ostPrt.name.lower() ,cls._PortConfigList.port[:]))[0]
         pIdList = ost_pb.PortIdList()
         pIdList.port_id.add().id = ostPortInfo.port_id.id
         pConfig = cls._drone.getPortConfig(pIdList)
     except Exception as e:
         raise Exception("Failed to assotiate ip to Nic... maybe wrong ip?\n"  + "\n" + str(e))
     return pIdList,pConfig
Exemplo n.º 2
0
 def refresh(self):
     self._parent._driver_obj.wait_for_up(20)
     self._parent._driver_obj.interfaceTable.send_arp_refresh()
     res_table = self._parent._driver_obj.interfaceTable.read_port_neighbors(
     )
     self.learned_table = []
     for if_key in res_table:
         iface_table = res_table[if_key]
         for entry in iface_table:
             isIp4 = True if Converter.intIp2string(Converter.uc23(
                 entry[1])) else False
             if isIp4:
                 self.learned_table.append(learned_entry(
                     entry[0], entry[1]))