Пример #1
0
    def test_add_remove_map_any_wwpn(self):
        """Tests a loop of add map/remove map when using _ANY_WWPN."""
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)

        # A fake mapping to the first IO Server
        p_map_vio1 = ('10000090FA5371F2', vfc_mapper._FUSED_ANY_WWPN)
        vfc_mapper.add_map(v_wrap, 'host_uuid', self.lpar_uuid, p_map_vio1)
        self.assertEqual(len_before + 1, len(v_wrap.vfc_mappings))

        # See if we can find that mapping.
        maps = vfc_mapper.find_maps(v_wrap.vfc_mappings,
                                    self.lpar_uuid,
                                    port_map=p_map_vio1)
        self.assertEqual(1, len(maps))

        # Even though we were searching for a 'FUSED' wwpn, the mapping itself
        # will have nothing on it, to indicate that the API should generate
        # the WWPNs.  Therefore, we validate that we found the mapping without
        # any WWPNs on it.
        self.assertEqual([], maps[0].client_adapter.wwpns)

        # Now try to remove it...
        vfc_mapper.remove_maps(v_wrap, self.lpar_uuid, port_map=p_map_vio1)
        self.assertEqual(len_before, len(v_wrap.vfc_mappings))
Пример #2
0
    def test_add_remove_map_any_wwpn(self):
        """Tests a loop of add map/remove map when using _ANY_WWPN."""
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)

        # A fake mapping to the first IO Server
        p_map_vio1 = ('10000090FA5371F2', vfc_mapper._FUSED_ANY_WWPN)
        vfc_mapper.add_map(v_wrap, 'host_uuid', self.lpar_uuid, p_map_vio1)
        self.assertEqual(len_before + 1, len(v_wrap.vfc_mappings))

        # See if we can find that mapping.
        maps = vfc_mapper.find_maps(v_wrap.vfc_mappings, self.lpar_uuid,
                                    port_map=p_map_vio1)
        self.assertEqual(1, len(maps))

        # Even though we were searching for a 'FUSED' wwpn, the mapping itself
        # will have nothing on it, to indicate that the API should generate
        # the WWPNs.  Therefore, we validate that we found the mapping without
        # any WWPNs on it.
        self.assertEqual([], maps[0].client_adapter.wwpns)

        # Now try to remove it...
        vfc_mapper.remove_maps(v_wrap, self.lpar_uuid, port_map=p_map_vio1)
        self.assertEqual(len_before, len(v_wrap.vfc_mappings))
Пример #3
0
    def test_remove_maps(self):
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)
        resp_list = vfc_mapper.remove_maps(v_wrap, 10)
        expected_removals = {
            'U7895.43X.21EF9FB-V63-C3', 'U7895.43X.21EF9FB-V66-C4',
            'U7895.43X.21EF9FB-V62-C4', 'U7895.43X.21EF9FB-V10-C4'
        }
        self.assertEqual(set([el.client_adapter.loc_code for el in resp_list]),
                         expected_removals)
        self.assertEqual(len_before - 4, len(v_wrap.vfc_mappings))

        # Make sure the remaining adapters do not have the remove codes.
        for remaining_map in v_wrap.vfc_mappings:
            if remaining_map.client_adapter is not None:
                self.assertNotIn(remaining_map.client_adapter.loc_code,
                                 expected_removals)
Пример #4
0
    def test_remove_maps(self):
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)
        resp_list = vfc_mapper.remove_maps(v_wrap, 10)
        expected_removals = {
            'U7895.43X.21EF9FB-V63-C3', 'U7895.43X.21EF9FB-V66-C4',
            'U7895.43X.21EF9FB-V62-C4', 'U7895.43X.21EF9FB-V10-C4'}
        self.assertEqual(
            set([el.client_adapter.loc_code for el in resp_list]),
            expected_removals)
        self.assertEqual(len_before - 4, len(v_wrap.vfc_mappings))

        # Make sure the remaining adapters do not have the remove codes.
        for remaining_map in v_wrap.vfc_mappings:
            if remaining_map.client_adapter is not None:
                self.assertNotIn(remaining_map.client_adapter.loc_code,
                                 expected_removals)
Пример #5
0
    def test_remove_maps_client_adpt(self):
        """Tests the remove_maps method, with the client_adpt input."""
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)

        c_adpt = vfc_mapper.find_maps(v_wrap.vfc_mappings,
                                      10)[0].client_adapter

        resp_list = vfc_mapper.remove_maps(v_wrap, 10, client_adpt=c_adpt)
        expected_removals = {'U7895.43X.21EF9FB-V63-C3'}
        self.assertEqual(set([el.client_adapter.loc_code for el in resp_list]),
                         expected_removals)
        self.assertEqual(len_before - 1, len(v_wrap.vfc_mappings))

        # Make sure the remaining adapters do not have the remove codes.
        for remaining_map in v_wrap.vfc_mappings:
            if remaining_map.client_adapter is not None:
                self.assertNotIn(remaining_map.client_adapter.loc_code,
                                 expected_removals)
Пример #6
0
    def test_remove_maps_client_adpt(self):
        """Tests the remove_maps method, with the client_adpt input."""
        v_wrap = self.entries[0]
        len_before = len(v_wrap.vfc_mappings)

        c_adpt = vfc_mapper.find_maps(
            v_wrap.vfc_mappings, 10)[0].client_adapter

        resp_list = vfc_mapper.remove_maps(v_wrap, 10, client_adpt=c_adpt)
        expected_removals = {'U7895.43X.21EF9FB-V63-C3'}
        self.assertEqual(
            set([el.client_adapter.loc_code for el in resp_list]),
            expected_removals)
        self.assertEqual(len_before - 1, len(v_wrap.vfc_mappings))

        # Make sure the remaining adapters do not have the remove codes.
        for remaining_map in v_wrap.vfc_mappings:
            if remaining_map.client_adapter is not None:
                self.assertNotIn(remaining_map.client_adapter.loc_code,
                                 expected_removals)