mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
Fix port_name in ports so it is more like other times we do this.
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
|
# !/usr/bin/env python3
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from LANforge.lfcli_base import LFCliBase
|
from LANforge.lfcli_base import LFCliBase
|
||||||
import pprint
|
import pprint
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class GenCXProfile(LFCliBase):
|
class GenCXProfile(LFCliBase):
|
||||||
def __init__(self, lfclient_host, lfclient_port, local_realm, debug_=False):
|
def __init__(self, lfclient_host, lfclient_port, local_realm, debug_=False):
|
||||||
super().__init__(lfclient_host, lfclient_port, debug_)
|
super().__init__(lfclient_host, lfclient_port, debug_)
|
||||||
@@ -144,16 +144,9 @@ class GenCXProfile(LFCliBase):
|
|||||||
count = 40
|
count = 40
|
||||||
for i in range(0, count):
|
for i in range(0, count):
|
||||||
port_info = self.local_realm.name_to_eid(sta_port)
|
port_info = self.local_realm.name_to_eid(sta_port)
|
||||||
if len(port_info) == 2:
|
|
||||||
resource = 1
|
|
||||||
shelf = port_info[0]
|
|
||||||
name = port_info[-1]
|
|
||||||
elif len(port_info) == 3:
|
|
||||||
resource = port_info[0]
|
resource = port_info[0]
|
||||||
shelf = port_info[1]
|
shelf = port_info[1]
|
||||||
name = port_info[-1]
|
name = port_info[2]
|
||||||
else:
|
|
||||||
raise ValueError("Unexpected name for port_name %s" % sta_port)
|
|
||||||
|
|
||||||
gen_name_a = "%s-%s" % (self.name_prefix, name) + "_" + str(i) + add
|
gen_name_a = "%s-%s" % (self.name_prefix, name) + "_" + str(i) + add
|
||||||
gen_name_b = "D_%s-%s" % (self.name_prefix, name) + "_" + str(i) + add
|
gen_name_b = "D_%s-%s" % (self.name_prefix, name) + "_" + str(i) + add
|
||||||
@@ -165,15 +158,11 @@ class GenCXProfile(LFCliBase):
|
|||||||
print("hello............", sta_port)
|
print("hello............", sta_port)
|
||||||
for i in range(0, 5):
|
for i in range(0, 5):
|
||||||
port_info = self.local_realm.name_to_eid(port_name)
|
port_info = self.local_realm.name_to_eid(port_name)
|
||||||
if len(port_info) == 2:
|
try:
|
||||||
resource = 1
|
|
||||||
shelf = port_info[0]
|
|
||||||
name = port_info[-1]
|
|
||||||
elif len(port_info) == 3:
|
|
||||||
resource = port_info[0]
|
resource = port_info[0]
|
||||||
shelf = port_info[1]
|
shelf = port_info[1]
|
||||||
name = port_info[-1]
|
name = port_info[2]
|
||||||
else:
|
except:
|
||||||
raise ValueError("Unexpected name for port_name %s" % port_name)
|
raise ValueError("Unexpected name for port_name %s" % port_name)
|
||||||
|
|
||||||
# this naming convention follows what you see when you use
|
# this naming convention follows what you see when you use
|
||||||
@@ -282,16 +271,9 @@ class GenCXProfile(LFCliBase):
|
|||||||
endp_tpls = []
|
endp_tpls = []
|
||||||
for port_name in ports:
|
for port_name in ports:
|
||||||
port_info = self.local_realm.name_to_eid(port_name)
|
port_info = self.local_realm.name_to_eid(port_name)
|
||||||
if len(port_info) == 2:
|
|
||||||
resource = 1
|
|
||||||
shelf = port_info[0]
|
|
||||||
name = port_info[-1]
|
|
||||||
elif len(port_info) == 3:
|
|
||||||
resource = port_info[0]
|
resource = port_info[0]
|
||||||
shelf = port_info[1]
|
shelf = port_info[1]
|
||||||
name = port_info[-1]
|
name = port_info[2]
|
||||||
else:
|
|
||||||
raise ValueError("Unexpected name for port_name %s" % port_name)
|
|
||||||
|
|
||||||
# this naming convention follows what you see when you use
|
# this naming convention follows what you see when you use
|
||||||
# lf_firemod.pl --action list_endp after creating a generic endpoint
|
# lf_firemod.pl --action list_endp after creating a generic endpoint
|
||||||
|
|||||||
Reference in New Issue
Block a user