diff --git a/py-json/LANforge/LFUtils.py b/py-json/LANforge/LFUtils.py index 464c1e21..cca1ba05 100644 --- a/py-json/LANforge/LFUtils.py +++ b/py-json/LANforge/LFUtils.py @@ -549,8 +549,11 @@ def waitUntilPortsAppear(base_url="http://localhost:8080", port_list=(), debug=F """ return wait_until_ports_appear(base_url, port_list, debug=debug) -def name_to_eid(input, non_port=False): - rv = [1, 1, "", ""] +def name_to_eid(input, non_port=False, resource=None): + if resource is None: + rv = [1, 1, "", ""] + else: + rv = [1, resource, "", ""] info = [] if (input is None) or (input == ""): raise ValueError("name_to_eid wants eid like 1.1.sta0 but given[%s]" % input) diff --git a/py-json/gen_cxprofile.py b/py-json/gen_cxprofile.py index 811eccd6..0bea33a6 100644 --- a/py-json/gen_cxprofile.py +++ b/py-json/gen_cxprofile.py @@ -152,8 +152,8 @@ class GenCXProfile(LFCliBase): count = 40 for i in range(0, count): port_info = self.local_realm.name_to_eid(sta_port) - resource = port_info[0] - shelf = port_info[1] + resource = port_info[1] + shelf = port_info[0] name = port_info[2] gen_name_a = "%s-%s" % (self.name_prefix, name) + "_" + str(i) + add @@ -167,8 +167,8 @@ class GenCXProfile(LFCliBase): for i in range(0, 5): port_info = self.local_realm.name_to_eid(port_name) try: - resource = port_info[0] - shelf = port_info[1] + resource = port_info[1] + shelf = port_info[0] name = port_info[2] except: raise ValueError("Unexpected name for port_name %s" % port_name) @@ -279,8 +279,8 @@ class GenCXProfile(LFCliBase): endp_tpls = [] for port_name in ports: port_info = self.local_realm.name_to_eid(port_name) - resource = port_info[0] - shelf = port_info[1] + resource = port_info[1] + shelf = port_info[0] name = port_info[2] # this naming convention follows what you see when you use diff --git a/py-json/mac_vlan_profile.py b/py-json/mac_vlan_profile.py index edfbdc82..ebc23549 100644 --- a/py-json/mac_vlan_profile.py +++ b/py-json/mac_vlan_profile.py @@ -136,6 +136,7 @@ class MACVLANProfile(LFCliBase): set_port.set_port_current_flags) self.set_port_data["interest"] = self.add_named_flags(self.desired_set_port_interest_flags, set_port.set_port_interest_flags) + self.set_port_data["resource"] = self.resource set_port_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_port") for i in range(len(self.desired_macvlans)): diff --git a/py-json/realm.py b/py-json/realm.py index 02f825b3..a01bf92b 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -582,12 +582,12 @@ class Realm(LFCliBase): return matched_map - def name_to_eid(self, eid, debug=False, non_port=False): + def name_to_eid(self, eid, debug=False, non_port=False, resource=None): if debug: self.logg(level="debug", mesg="name_to_eid: "+str(eid)) if (type(eid) is list) or (type(eid) is tuple): return eid - return LFUtils.name_to_eid(eid, non_port=non_port) + return LFUtils.name_to_eid(eid, non_port=non_port, resource=None) def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=360, debug=False): if not (ipv4 or ipv6): diff --git a/py-json/station_profile.py b/py-json/station_profile.py index e3046779..e3fae52b 100644 --- a/py-json/station_profile.py +++ b/py-json/station_profile.py @@ -373,10 +373,11 @@ class StationProfile: suppress_related_commands_=True, use_radius=False, hs20_enable=False, - sleep_time=0.02): + sleep_time=0.02, + resource=None): if (radio is None) or (radio == ""): raise ValueError("station_profile.create: will not create stations without radio") - radio_eid = self.local_realm.name_to_eid(radio) + radio_eid = self.local_realm.name_to_eid(radio, resource=resource) radio_shelf = radio_eid[0] radio_resource = radio_eid[1] radio_port = radio_eid[2]