PROBLEM: Unable to retrieve value for MTU when default is used

I'm trying to automate a test which checks that the default values are being set correctly when adding a network to a host. When I create a network without specifying a value for the MTU, I can see from the web UI that the default value (1500) is being used. When I try to retrieve this MTU value from the SDK to ensure it is set correctly, the value returned is '0'. The same issue is not occurring if I explicitly set the MTU value when creating the network. When the MTU value is assigned, instead of using the default value, it is possible to retrieve it from the SDK correctly. Is there any way I can retrieve the value for MTU from the SDK when the default is used?

Here is a sample of the code used in the network builder. Notice the double slashes (//) before the .mtu(), hence no value is being stated so that the default is used. //Configure initial network builder with empty name field NetworkBuilder networkBuilder = new NetworkBuilder() .name(EMPTY_NETWORK_NAME) //.mtu() .dataCenter(dataCenter() .name(dcName)) .usages(netUsageList) .ip( ip() .version(IpVersion.V4) .netmask(netMask) .gateway(netGateway)) .dnsResolverConfiguration( dnsResolverConfiguration() .nameServers(dnsName));

Hi, default MTU is internally represented as 0 and thus the value you are receiving is correct. On Thu, Sep 26, 2019 at 10:17 AM <james.holohan@oracle.com> wrote:
I'm trying to automate a test which checks that the default values are being set correctly when adding a network to a host. When I create a network without specifying a value for the MTU, I can see from the web UI that the default value (1500) is being used.
When I try to retrieve this MTU value from the SDK to ensure it is set correctly, the value returned is '0'.
The same issue is not occurring if I explicitly set the MTU value when creating the network. When the MTU value is assigned, instead of using the default value, it is possible to retrieve it from the SDK correctly.
Is there any way I can retrieve the value for MTU from the SDK when the default is used? _______________________________________________ Devel mailing list -- devel@ovirt.org To unsubscribe send an email to devel-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/BH72BEIAYKLEXQ...
-- Ales Musil Associate Software Engineer - RHV Network Red Hat EMEA <https://www.redhat.com> amusil@redhat.com IM: amusil <https://red.ht/sig>

Ok thanks

The network object created can be seen in the debugger, the value for "mtu" is "0", when the default should be 1500. The web portal shows the default value is "1500". When I try to retrieve the default value, it returns 0. However, if the value is explicitly stated, then it can be retrieved: net = {NetworkContainer@4322} display = null dnsResolverConfiguration = null ip = null mtu = {BigInteger@4369} "0" profileRequired = null required = null status = null stp = {Boolean@4370} false usages = {ArrayList@4371} size = 0 vlan = {VlanContainer@4372} cluster = null dataCenter = {DataCenterContainer@4373} externalProvider = null externalProviderPhysicalNetwork = null networkLabels = {ArrayListWithHref@4374} size = 0 permissions = {ArrayListWithHref@4375} size = 0 qos = null vnicProfiles = {ArrayListWithHref@4376} size = 0 comment = "comment" description = "description" href = "/ovirt-engine/api/networks/cb3909d1-28e7-4ff1-aa97-858286e407a6" id = "cb3909d1-28e7-4ff1-aa97-858286e407a6" name = "network1"
participants (3)
-
Ales Musil
-
james.holohan@oracle.com
-
Jamie Holohan