Verified Commit 1b5394ca authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

NSN.TIMOS.get_lldp_neighbors. Rewrite fixme port function.

parent b11dca86
Pipeline #32221 passed with stages
in 14 minutes and 11 seconds
...@@ -60,21 +60,15 @@ class Script(BaseScript): ...@@ -60,21 +60,15 @@ class Script(BaseScript):
@staticmethod @staticmethod
def fixport(port, port_type): def fixport(port, port_type):
# fix alcatel encode port like hex string # fix alcatel encode port like hex string
remote_port = "u"
if port_type == "5" and "\n " in port: if port_type == "5" and "\n " in port:
remote_port = port.replace("\n ", "") # PortId Subtype : 5 (interfaceName)
remote_port = remote_port.replace(":", "").replace("\n", "") # Port Id : 65:73:61:74:2D:32:2F:31:2F:32:31
remote_port = smart_text(codecs.decode(remote_port, "hex")) # "esat-2/1/21"
elif port_type == "5" and "\n" in port: remote_port_name1, remote_port__name2 = port.split("\n", 1)
remote_port = port.replace("\n", "") return smart_text(codecs.decode(remote_port_name1.strip().replace(":", ""), "hex"))
remote_port = remote_port.replace(":", "").replace("\n", "")
remote_port = smart_text(codecs.decode(remote_port, "hex"))
elif port_type == "5" and "\n " not in port:
remote_port = remote_port.replace(":", "").replace("\n", "")
remote_port = smart_text(codecs.decode(remote_port, "hex"))
elif port_type == "7": elif port_type == "7":
return port.replace("\n", "") return port.replace("\n", "")
return remote_port return port
def get_port_info(self, port): def get_port_info(self, port):
try: try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment