Hi there,
I am initiating a vApp from template using VMware_VCloud_SDK_Vdc::instantiateVAppTemplateDefault
I am then trying to configure the network settings.
$netRefs = $orgSDK->getOrgNetworkRefs();
$pnetwkRef = VMware_VCloud_SDK_Helper::createReferenceTypeObj($netRefs[0]->get_href(), 'ParentNetwork');
$info = new VMware_VCloud_API_OVF_Msg_Type();
$info->set_valueOf("Configuration parameters for logical networks");
$conf = new VMware_VCloud_API_NetworkConfigurationType();
$conf->setParentNetwork($pnetwkRef);
$conf->setFenceMode('bridged');
$ipScope = new VMware_VCloud_API_IpScopeType();
$ipScope->setIsInherited(true);
$ipScope->setNetmask('255.255.252.0');
$ipScope->setGateway('48.76.212.1');
$ipScope->setDns1('196.33.227.30');
$ipScope->setDns2('196.33.227.197');
$conf->setIpScope($ipScope);
$netconf = new VMware_VCloud_API_VAppNetworkConfigurationType();
$netconf->set_networkName('VM Network');
$netconf->setConfiguration($conf);
$netconf->setIsDeployed(true);
$section = new VMware_VCloud_API_NetworkConfigSectionType();
$section->setInfo($info);
$section->setNetworkConfig(array($netconf));
$iparams = new VMware_VCloud_API_InstantiationParamsType();
$iparams->setSection(array($section));
$params = new VMware_VCloud_API_RecomposeVAppParamsType();
$params->setInstantiationParams($iparams);
$this->log('Starting recomposition');
$task = $vAppSDK->recompose($params);
Then I attempt to set the IP address of the VM
$vmSDK = $this->getVMDSK($vm); /* @var $vmSDK VMware_VCloud_SDK_Vm */
$net = $vmSDK->getNetworkConnectionSettings();
$cons = $net->getNetworkConnection();
$con = $cons[0]; /* @var $con VMware_VCloud_API_NetworkConnectionType */
$con->setIpAddress($ip);
$con->setIpAddressAllocationMode('MANUAL');
$cons[0] = $con;
$net->setNetworkConnection($cons);
The problem that I am having is that the only thing that is being set is my DNS servers against the vApp.
When checking the logs, vCloud Director is saying that the IP address I am trying to assign to the VM is not part of the subnet range.
No errors or other log entries in the logs explaining why the subnet mask and gateway for the vApp is not being set.
Any assistance would be greatly appreciated.