@Override protected Network createNetworkEntity() { return new Network(); } }
public NetworkModel(SearchableListModel<?, ? extends Network> sourceListModel) { this(new Network(), sourceListModel); }
@Override protected void setUpNetworkQueryExpectations() { setUpEntityQueryExpectations(QueryType.GetNetworkById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { NETWORK_ID }, new Network()); } }
private int getDefaultHostMtu() { return NetworkUtils.getHostMtuActualValue(new Network()); }
protected void setGetNetworksQueryExpectations(int times) { while (times-- > 0) { ArrayList<org.ovirt.engine.core.common.businessentities.network.Network> networks = new ArrayList<>(); org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network(); network.setId(GUIDS[0]); network.setName("orcus"); networks.add(network); setUpEntityQueryExpectations(QueryType.GetAllNetworksByClusterId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, networks); } } }
protected void setGetNetworksQueryExpectations(int times) { while (times-- > 0) { ArrayList<org.ovirt.engine.core.common.businessentities.network.Network> networks = new ArrayList<>(); org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network(); network.setId(GUIDS[0]); network.setName("orcus"); networks.add(network); setUpEntityQueryExpectations(QueryType.GetAllNetworksByClusterId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, networks); } } }
@Test public void serializeNetwork() { Network net = new Network(); JsonObjectSerializer serializer = new JsonObjectSerializer(); assertTrue(serializer.serialize(net).length() > 0); }
private Network createNetwork(String networkA) { Network result = new Network(); result.setId(Guid.newGuid()); result.setName(networkA); return result; }
private LogicalNetworkModel createUnmanagedNetworkModel(String networkName, VdsNetworkInterface nic) { Network unmanagedNetwork = new Network(); unmanagedNetwork.setName(networkName); unmanagedNetwork.setVlanId(nic.getVlanId()); unmanagedNetwork.setMtu(nic.getMtu()); unmanagedNetwork.setVmNetwork(nic.isBridged()); LogicalNetworkModel networkModel = new LogicalNetworkModel(unmanagedNetwork, null, this); return networkModel; }
@Mapping(from = OpenStackNetwork.class, to = Network.class) public static Network map(OpenStackNetwork model, Network template) { Network entity = template != null? template: new Network(); if (model.isSetId()) { ProviderNetwork providedBy = new ProviderNetwork(); providedBy.setExternalId(model.getId()); entity.setProvidedBy(providedBy); } if (model.isSetName()) { entity.setName(model.getName()); } return entity; } }
@Override public Response doImport(Action action) { validateParameters(action, "dataCenter.id|name"); Guid dataCenterId = getDataCenterId(action); ProviderNetwork providerNetwork = new ProviderNetwork(new Guid(providerId), id); Network network = new Network(); network.setProvidedBy(providerNetwork); network.setDataCenterId(dataCenterId); network.setName(getNetwork().getName()); AddNetworkStoragePoolParameters parameters = new AddNetworkStoragePoolParameters(dataCenterId, network); return doAction(ActionType.AddNetwork, parameters, action); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); newNet = new Network(); newNet.setName("newnet1"); newNet.setVdsmName("newnet1"); newNet.setDescription("New network"); newNet.setDataCenterId(FixturesTool.DATA_CENTER); }
@Override protected org.ovirt.engine.core.common.businessentities.network.Network getEntity(int index) { org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network(); NetworkCluster networkCluster = new NetworkCluster(); networkCluster.setDisplay(false); networkCluster.setMigration(false); networkCluster.setRequired(false); networkCluster.setDefaultRoute(false); network.setCluster(networkCluster); network.setId(GUIDS[index]); network.setName(NAMES[index]); network.setDescription(DESCRIPTIONS[index]); network.setDataCenterId(GUIDS[1]); return network; }
@Mapping(from = Network.class, to = org.ovirt.engine.core.common.businessentities.network.Network.class) public static org.ovirt.engine.core.common.businessentities.network.Network map(Network model, org.ovirt.engine.core.common.businessentities.network.Network template) { org.ovirt.engine.core.common.businessentities.network.Network entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.network.Network(); entity.setCluster(template != null && template.getCluster() != null ? template.getCluster() : new NetworkCluster()); if (model.isSetId()) {
@BeforeEach public void setUp() { sampleDnsResolverConfiguration = new DnsResolverConfiguration(); sampleDnsResolverConfiguration.setNameServers(Arrays.asList( new NameServer("192.168.1.1"), new NameServer("2001:0db8:85a3:0000:0000:8a2e:0370:7334"))); sampleDnsResolverConfiguration2 = new DnsResolverConfiguration(); sampleDnsResolverConfiguration2.setNameServers(Arrays.asList( new NameServer("192.168.1.2"), new NameServer("2002:0db8:85a3:0000:0000:8a2e:0370:7334"))); sampleDnsResolverConfigurationWithReversedNameServers = reverseNameServersOrder(sampleDnsResolverConfiguration); ifaceQos = new HostNetworkQos(); networkQos = new HostNetworkQos(); iface = new VdsNetworkInterface(); //needed because network is vm network by default iface.setBridged(true); iface.setQos(ifaceQos); iface.setReportedSwitchType(SwitchType.LEGACY); iface.setIpv4DefaultRoute(false); iface.setMtu(getDefaultHostMtu()); network = new Network(); network.setDnsResolverConfiguration(sampleDnsResolverConfiguration); testedNetworkAttachment = new NetworkAttachment(); testedNetworkAttachment.setIpConfiguration(new IpConfiguration()); cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_2); cluster.setRequiredSwitchTypeForCluster(SwitchType.LEGACY); }
private static Network cloneNetwork(Network instance) { Network obj = new Network(); obj.setAddr(instance.getAddr()); obj.setDescription(instance.getDescription()); obj.setComment(instance.getComment()); obj.setId(instance.getId()); obj.setName(instance.getName()); obj.setVdsmName(instance.getVdsmName()); obj.setSubnet(instance.getSubnet()); obj.setGateway(instance.getGateway()); obj.setType(instance.getType()); obj.setVlanId(instance.getVlanId()); obj.setStp(instance.getStp()); obj.setDataCenterId(instance.getDataCenterId()); obj.setMtu(instance.getMtu()); obj.setVmNetwork(instance.isVmNetwork()); if (instance.getCluster() !=null){ obj.setCluster(cloneNetworkCluster(instance.getCluster())); } if (instance.getProvidedBy() != null) { obj.setProvidedBy(cloneProviderNetwork(instance.getProvidedBy())); } return obj; }