예제 #1
0
    def _find_veas(self, vea_dom, k2vios, k2sea):
        """
        Will return a pair of data.  The first is the k2_vios_vea which
        represents the k2element for the VEA on the k2_vios TrunkAdapters
        list.  The second is the k2_sea_vea, which represents the k2element
        for the VEA on the k2sea TrunkAdapters list.

        :param vea_dom: The dom level element to search against.
        :param k2vios: The k2element representing the VIOS
        :param k2sea: The k2element representing the owning SEA
        """
        pvid = vea_dom.pvid
        vswitch_map = self._topo.vswitch_map
        vswitch_id = utils.find_vswitch_id_for_name(vea_dom.vswitch_name,
                                                    vswitch_map)

        # Find the VEA we're trying to delete
        k2vea_on_sea = None
        trunk_list = k2sea.findall('./TrunkAdapters/TrunkAdapter')
        for adapter in trunk_list:
            if pvid == int(adapter.findtext('PortVLANID')) and\
                    vswitch_id == adapter.findtext('VirtualSwitchID'):
                k2vea_on_sea = adapter
                break

        k2vea_on_vios = None
        for adapter in k2vios.element.findall('./TrunkAdapters/TrunkAdapter'):
            if pvid == int(adapter.findtext('PortVLANID')) and\
                    vswitch_id == adapter.findtext('VirtualSwitchID'):
                k2vea_on_vios = adapter
                break
        return k2vea_on_vios, k2vea_on_sea
예제 #2
0
    def _find_vswitch_id(self, sea):
        """
        Returns the K2 VSwitch ID for the given Shared Ethernet Adapter.

        :param sea: DOM object that represents the SEA
        :returns: The K2 VSwitch ID that represents the appropriate vSwitch.
        """
        vswitch_name = sea.get_primary_vea().vswitch_name
        return utils.find_vswitch_id_for_name(vswitch_name,
                                              self._topo.vswitch_map)