示例#1
0
    def _create_mappings(self):
        target_same_as_source = self._create_mapping(
            NETS['target_same_as_source'], NETS['target_same_as_source'])

        ovirtmgmt_target = self._create_mapping(NETS['to_ovirtmgmt'],
                                                'ovirtmgmt')

        other_target = self._create_mapping(NETS['n4'], NETS['n5'])

        no_profile_target = self._create_mapping(NETS['to_no_profile'], '')

        source_not_exists = self._create_mapping(OVF['not_on_engine'],
                                                 OVF['not_on_engine'])

        source_deleted_profile_with_target = self._create_mapping(
            NETS['deleted_profile_with_target'], 'ovirtmgmt')

        source_deleted_network_with_target = self._create_mapping(
            NETS['deleted_network_with_target'], 'ovirtmgmt')

        source_deleted_target_profile_empty_string = self._create_mapping(
            NETS['deleted_profile_to_no_profile'], '')

        source_deleted_target_network_empty_string = self._create_mapping(
            NETS['deleted_network_to_no_profile'], '')

        not_on_engine = self._create_mapping(OVF['not_on_engine'],
                                             OVF['not_on_engine'])

        no_source = self._create_mapping_no_source(OVF['no_source'])

        no_target = self._create_mapping_no_target(NETS['no_target'])

        p4 = next(p for p in self._profiles if p.name == NETS['n4'])
        target_by_id = self._create_mapping_target_id(NETS['n5'], p4.id)

        empty_mapping = RegistrationVnicProfileMapping()

        return (
            target_same_as_source,
            other_target,
            ovirtmgmt_target,
            no_profile_target,
            no_target,
            not_on_engine,
            no_source,
            source_not_exists,
            source_deleted_profile_with_target,
            source_deleted_network_with_target,
            source_deleted_target_profile_empty_string,
            source_deleted_target_network_empty_string,
            target_by_id,
            empty_mapping,
        )
示例#2
0
 def _create_mapping_target_id(self, from_name, to_id):
     return RegistrationVnicProfileMapping(
         from_=VnicProfile(name=from_name, network=Network(name=from_name)),
         to=VnicProfile(id=to_id),
     )
示例#3
0
 def _create_mapping_no_source(self, to_name):
     return RegistrationVnicProfileMapping(
         from_=None,
         to=VnicProfile(name=to_name, network=Network(name=to_name)),
     )
示例#4
0
 def _create_mapping_no_target(self, from_name):
     return RegistrationVnicProfileMapping(
         from_=VnicProfile(name=from_name, network=Network(name=from_name)),
         to=None,
     )
示例#5
0
 def _create_mapping(self, from_name, to_name):
     return RegistrationVnicProfileMapping(
         from_=VnicProfile(name=from_name, network=Network(name=from_name)),
         to=VnicProfile(name=to_name, network=Network(name=to_name)))