def load_grps(self): """Returns the load groups. The first in the list is the primary.""" lg_list = [ LoadGroup.wrap(x, nb_root=self) for x in self.element.findall(u.xpath(_NB_LGS, _NB_LG)) ] temp_list = _order_by_pvid(lg_list, self.pvid) return ewrap.ActionableList(temp_list, self._load_grps)
def vnet_uri_list(self): """Returns a list of the Virtual Network URIs. If the vnet_aware trait (see traits.py) is set to False, the user should not modify this. Virtual Networks become 'realized' off of the system's VLANs/vSwitches. However, if set to True, one can add a Virtual Network to the vSwitch before it is used. The task classes (cna.py and network_bridger.py) should abstract the user away from these deviations in traits. """ uri_resp_list = list(self.get_href(u.xpath(_LG_VNETS, c.LINK))) return ewrap.ActionableList(uri_resp_list, self.__update_uri_list)
def tagged_vlans(self): """Returns a list of additional VLANs on this adapter. Only valid if tagged vlan support is on. """ addl_vlans = self._get_val_str(_VADPT_TAGGED_VLANS, '') list_data = [] if addl_vlans != '': list_data = [int(i) for i in addl_vlans.split(' ')] def update_list(new_list): data = ' '.join([str(j) for j in new_list]) self.set_parm_value(_VADPT_TAGGED_VLANS, data) return ewrap.ActionableList(list_data, update_list)
def vnet_uri_list(self): """Returns a list of the Virtual Network URIs. If the vnet_aware trait (see traits.py) is set, then the addition of VLANs is driven via virtual networks rather than straight VLAN modification. This uri list is what drives the modification. If the trait is set to false, then the modification should be driven via the trunk adapters on the SEA directly. This list will also be empty. The task classes (cna.py and network_bridger.py) should abstract the user away from these deviations in traits. """ uri_resp_list = list(self.get_href(u.xpath(_LG_VNETS, c.LINK))) return ewrap.ActionableList(uri_resp_list, self.__update_uri_list)
def tagged_vlans(self): """Returns the tagged VLAN IDs that are allowed to pass through. Assumes has_tag_support() returns True. If not, an empty list will be returned. """ addl_vlans = self._get_val_str(_TA_VLAN_IDS, '') list_data = [] if addl_vlans != '': list_data = [int(i) for i in addl_vlans.split(' ')] def update_list(new_list): data = ' '.join([str(j) for j in new_list]) self.set_parm_value(_TA_VLAN_IDS, data) return ewrap.ActionableList(list_data, update_list)
def addl_adpts(self): """Non-primary TrunkAdapters on this Shared Ethernet Adapter. If the vnet_aware trait (see traits.py) is set to True, then the modification of a Network Bridge should be driven via the LoadGroup. If set to False, the LoadGroups simply reflect the state of the system and can't be used for modification. In those scenarios, modification should be done directly against the Trunk Adapters. :return: List of TrunkAdapter wrappers. May be the empty list. """ # TODO(thorst): Second return unreachable! Use self.traits.vnet_aware. return ewrap.ActionableList(self._get_trunks()[1:], self._addl_adpts) return tuple(self._get_trunks()[1:])