Search in sources :

Example 1 with NetworkLabels

use of org.ovirt.engine.api.model.NetworkLabels in project ovirt-engine by oVirt.

the class AbstractBaseHostNicLabelsResource method mapCollection.

private NetworkLabels mapCollection(List<org.ovirt.engine.core.common.businessentities.network.pseudo.NetworkLabel> networkLabels) {
    NetworkLabels labels = new NetworkLabels();
    for (org.ovirt.engine.core.common.businessentities.network.pseudo.NetworkLabel networkLabel : networkLabels) {
        NetworkLabel label = new NetworkLabel();
        label.setId(networkLabel.getId());
        labels.getNetworkLabels().add(label);
        addLinks(label, HostNic.class);
    }
    return labels;
}
Also used : NetworkLabels(org.ovirt.engine.api.model.NetworkLabels) NetworkLabel(org.ovirt.engine.api.model.NetworkLabel)

Example 2 with NetworkLabels

use of org.ovirt.engine.api.model.NetworkLabels in project ovirt-engine by oVirt.

the class BackendNetworkLabelsResource method mapCollection.

private NetworkLabels mapCollection(List<org.ovirt.engine.core.common.businessentities.network.pseudo.NetworkLabel> networkLabels) {
    NetworkLabels labels = new NetworkLabels();
    for (org.ovirt.engine.core.common.businessentities.network.pseudo.NetworkLabel networkLabel : networkLabels) {
        NetworkLabel label = new NetworkLabel();
        label.setId(networkLabel.getId());
        labels.getNetworkLabels().add(label);
        addLinks(label, Network.class);
    }
    return labels;
}
Also used : NetworkLabels(org.ovirt.engine.api.model.NetworkLabels) NetworkLabel(org.ovirt.engine.api.model.NetworkLabel)

Example 3 with NetworkLabels

use of org.ovirt.engine.api.model.NetworkLabels in project ovirt-engine by oVirt.

the class V3NetworkInAdapter method adapt.

@Override
public Network adapt(V3Network from) {
    Network to = new Network();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptIn(from.getCluster()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptIn(from.getDataCenter()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisplay()) {
        to.setDisplay(from.isDisplay());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetIp()) {
        to.setIp(adaptIn(from.getIp()));
    }
    if (from.isSetLabels()) {
        to.setNetworkLabels(new NetworkLabels());
        to.getNetworkLabels().getNetworkLabels().addAll(adaptIn(from.getLabels().getLabels()));
    }
    if (from.isSetMtu()) {
        to.setMtu(from.getMtu());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetProfileRequired()) {
        to.setProfileRequired(from.isProfileRequired());
    }
    if (from.isSetQos()) {
        to.setQos(adaptIn(from.getQos()));
    }
    if (from.isSetRequired()) {
        to.setRequired(from.isRequired());
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(NetworkStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStp()) {
        to.setStp(from.isStp());
    }
    if (from.isSetUsages()) {
        Network.UsagesList toUsages = to.getUsages();
        if (toUsages == null) {
            toUsages = new Network.UsagesList();
            to.setUsages(toUsages);
        }
        List<NetworkUsage> toList = toUsages.getUsages();
        from.getUsages().getUsages().forEach(usage -> toList.add(NetworkUsage.fromValue(usage)));
    }
    if (from.isSetVlan()) {
        to.setVlan(adaptIn(from.getVlan()));
    }
    return to;
}
Also used : NetworkLabels(org.ovirt.engine.api.model.NetworkLabels) Network(org.ovirt.engine.api.model.Network) V3Network(org.ovirt.engine.api.v3.types.V3Network) NetworkUsage(org.ovirt.engine.api.model.NetworkUsage)

Example 4 with NetworkLabels

use of org.ovirt.engine.api.model.NetworkLabels in project ovirt-engine by oVirt.

the class V3HostNICInAdapter method adapt.

@Override
public HostNic adapt(V3HostNIC from) {
    HostNic to = new HostNic();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBaseInterface()) {
        to.setBaseInterface(from.getBaseInterface());
    }
    if (from.isSetBonding()) {
        to.setBonding(adaptIn(from.getBonding()));
    }
    if (from.isSetBootProtocol()) {
        to.setBootProtocol(BootProtocol.fromValue(from.getBootProtocol()));
    }
    if (from.isSetBridged()) {
        to.setBridged(from.isBridged());
    }
    if (from.isSetCheckConnectivity()) {
        to.setCheckConnectivity(from.isCheckConnectivity());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCustomConfiguration()) {
        to.setCustomConfiguration(from.isCustomConfiguration());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetIp()) {
        to.setIp(adaptIn(from.getIp()));
    }
    if (from.isSetLabels()) {
        to.setNetworkLabels(new NetworkLabels());
        to.getNetworkLabels().getNetworkLabels().addAll(adaptIn(from.getLabels().getLabels()));
    }
    if (from.isSetMac()) {
        to.setMac(adaptIn(from.getMac()));
    }
    if (from.isSetMtu()) {
        to.setMtu(from.getMtu());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNetwork()) {
        to.setNetwork(adaptIn(from.getNetwork()));
    }
    if (from.isSetOverrideConfiguration()) {
        to.setOverrideConfiguration(from.isOverrideConfiguration());
    }
    if (from.isSetPhysicalFunction()) {
        to.setPhysicalFunction(adaptIn(from.getPhysicalFunction()));
    }
    if (from.isSetProperties()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
    }
    if (from.isSetQos()) {
        to.setQos(adaptIn(from.getQos()));
    }
    if (from.isSetSpeed()) {
        to.setSpeed(from.getSpeed());
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(NicStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetVirtualFunctionsConfiguration()) {
        to.setVirtualFunctionsConfiguration(adaptIn(from.getVirtualFunctionsConfiguration()));
    }
    if (from.isSetVlan()) {
        to.setVlan(adaptIn(from.getVlan()));
    }
    return to;
}
Also used : HostNic(org.ovirt.engine.api.model.HostNic) NetworkLabels(org.ovirt.engine.api.model.NetworkLabels) Properties(org.ovirt.engine.api.model.Properties) Statistics(org.ovirt.engine.api.model.Statistics)

Example 5 with NetworkLabels

use of org.ovirt.engine.api.model.NetworkLabels in project ovirt-engine by oVirt.

the class V3LabelsInAdapter method adapt.

@Override
public NetworkLabels adapt(V3Labels from) {
    NetworkLabels to = new NetworkLabels();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getNetworkLabels().addAll(adaptIn(from.getLabels()));
    return to;
}
Also used : NetworkLabels(org.ovirt.engine.api.model.NetworkLabels)

Aggregations

NetworkLabels (org.ovirt.engine.api.model.NetworkLabels)6 NetworkLabel (org.ovirt.engine.api.model.NetworkLabel)3 Network (org.ovirt.engine.api.model.Network)2 HostNic (org.ovirt.engine.api.model.HostNic)1 NetworkUsage (org.ovirt.engine.api.model.NetworkUsage)1 Properties (org.ovirt.engine.api.model.Properties)1 Statistics (org.ovirt.engine.api.model.Statistics)1 V3Network (org.ovirt.engine.api.v3.types.V3Network)1