use of net.nuage.vsp.acs.client.api.model.VspNic in project cloudstack by apache.
the class NuageVspEntityBuilderTest method testBuildVspNic.
@Test
public void testBuildVspNic() {
VspNic vspNic = _nuageVspEntityBuilder.buildVspNic("nicUuid", _mockedNicProfile);
validateVspNic(vspNic);
vspNic = _nuageVspEntityBuilder.buildVspNic(_mockedNic);
validateVspNic(vspNic);
}
use of net.nuage.vsp.acs.client.api.model.VspNic in project cloudstack by apache.
the class NuageVspEntityBuilder method buildVspStaticNat.
public VspStaticNat buildVspStaticNat(Boolean forRevoke, IPAddressVO staticNatIp, VlanVO staticNatVlan, NicVO nic) {
VspStaticNat.Builder vspStaticNatBuilder = new VspStaticNat.Builder().ipUuid(staticNatIp.getUuid()).ipAddress(staticNatIp.getAddress().addr()).revoke(forRevoke).oneToOneNat(staticNatIp.isOneToOneNat()).vlanUuid(staticNatVlan.getUuid()).vlanGateway(staticNatVlan.getVlanGateway()).vlanNetmask(staticNatVlan.getVlanNetmask()).vlanUnderlay(NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, staticNatVlan));
if (nic != null) {
VspNic vspNic = buildVspNic(nic);
vspStaticNatBuilder.nic(vspNic);
}
return vspStaticNatBuilder.build();
}
use of net.nuage.vsp.acs.client.api.model.VspNic in project cloudstack by apache.
the class NuageVspGuestNetworkGuru method deallocate.
@Override
@DB
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
boolean lockedNetwork = lockNetworkForUserVm(network, vm);
if (lockedNetwork && s_logger.isDebugEnabled()) {
s_logger.debug("Locked network " + network.getId() + " for deallocation of user VM " + vm.getInstanceName());
}
try {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Handling deallocate() call back, which is called when a VM is destroyed or interface is removed, " + "to delete VM Interface with IP " + nic.getIPv4Address() + " from a VM " + vm.getInstanceName() + " with state " + vm.getVirtualMachine().getState());
}
NicVO nicFromDb = _nicDao.findById(nic.getId());
VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(vm.getVirtualMachine().getDomainId(), network);
VspVm vspVm = _nuageVspEntityBuilder.buildVspVm(vm.getVirtualMachine(), network);
VspNic vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic);
HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
DeallocateVmVspCommand cmd = new DeallocateVmVspCommand(vspNetwork, vspVm, vspNic);
Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
s_logger.error("DeallocateVmNuageVspCommand for VM " + vm.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
if ((null != answer) && (null != answer.getDetails())) {
s_logger.error(answer.getDetails());
}
}
// because it is still allocated for the VR.
if (vspNetwork.isShared() && VirtualMachine.Type.User.equals(vm.getType()) && nic.getIPv4Address().equals(vspNetwork.getVirtualRouterIp())) {
nic.deallocate();
} else {
super.deallocate(network, nic, vm);
}
} finally {
if (network != null && lockedNetwork) {
_networkDao.releaseFromLockTable(network.getId());
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unlocked network " + network.getId() + " for deallocation of user VM " + vm.getInstanceName());
}
}
}
}
use of net.nuage.vsp.acs.client.api.model.VspNic in project cloudstack by apache.
the class NuageVspResourceTest method testDeallocateVmVspCommand.
@Test
public void testDeallocateVmVspCommand() throws Exception {
_resource.configure("NuageVspResource", _hostDetails);
VspNetwork vspNetwork = buildVspNetwork();
VspVm vspVm = buildVspVm();
VspNic vspNic = buildVspNic();
DeallocateVmVspCommand cmd = new DeallocateVmVspCommand(vspNetwork, vspVm, vspNic);
Answer dellocateVmAns = _resource.executeRequest(cmd);
assertTrue(dellocateVmAns.getResult());
}
use of net.nuage.vsp.acs.client.api.model.VspNic in project cloudstack by apache.
the class NuageVspResourceTest method testReserveVmInterfaceVspCommand.
@Test
public void testReserveVmInterfaceVspCommand() throws Exception {
_resource.configure("NuageVspResource", _hostDetails);
VspNetwork vspNetwork = buildVspNetwork();
VspVm vspVm = buildVspVm();
VspNic vspNic = buildVspNic();
VspStaticNat vspStaticNat = buildVspStaticNat();
VspDhcpVMOption vspDhcpOption = buildspDhcpVMOption();
ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, vspStaticNat, vspDhcpOption);
Answer rsrvVmInfAns = _resource.executeRequest(cmd);
assertTrue(rsrvVmInfAns.getResult());
}
Aggregations