def add_filter(ovirt_api4):
engine = ovirt_api4.system_service()
nics_service = test_utils.get_nics_service(engine, VM0_NAME)
nic = nics_service.list()[0]
network = ovirt_api4.follow_link(nic.vnic_profile).network
network_filters_service = engine.network_filters_service()
network_filter = next(
network_filter for network_filter in network_filters_service.list()
if network_filter.name == NETWORK_FILTER_NAME
)
vnic_profiles_service = engine.vnic_profiles_service()
vnic_profile = vnic_profiles_service.add(
types.VnicProfile(
name='{}_profile'.format(network_filter.name),
network=network,
network_filter=network_filter
)
)
nic.vnic_profile = vnic_profile
nt.assert_true(
nics_service.nic_service(nic.id).update(nic)
)
评论列表
文章目录