use of com.cloud.agent.api.to.IpAddressTO in project cloudstack by apache.
the class VirtualRoutingResourceTest method prepareNetworkElementCommand.
private ExecutionResult prepareNetworkElementCommand(final SetSourceNatCommand cmd) {
final IpAddressTO ip = cmd.getIpAddress();
ip.setNicDevId(1);
return new ExecutionResult(true, null);
}
use of com.cloud.agent.api.to.IpAddressTO in project cloudstack by apache.
the class VirtualRoutingResourceTest method generateIpAssocVpcCommand.
protected IpAssocVpcCommand generateIpAssocVpcCommand() {
final List<IpAddressTO> ips = new ArrayList<IpAddressTO>();
ips.add(new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
ips.add(new IpAddressTO(2, "64.1.1.11", false, false, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false));
ips.add(new IpAddressTO(3, "65.1.1.11", true, false, false, "vlan://65", "65.1.1.1", "255.255.255.0", "11:23:45:67:89:AB", 1000, false));
final IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
final IpAssocVpcCommand cmd = new IpAssocVpcCommand(ipArray);
cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
// AnswersCount is clearly wrong as it doesn't know enough to tell
assertEquals(6, cmd.getAnswersCount());
return cmd;
}
use of com.cloud.agent.api.to.IpAddressTO in project cloudstack by apache.
the class VirtualRoutingResourceTest method generateSetSourceNatCommand.
protected SetSourceNatCommand generateSetSourceNatCommand() {
final IpAddressTO ip = new IpAddressTO(1, "64.1.1.10", true, true, true, "vlan://64", "64.1.1.1", "255.255.255.0", "01:23:45:67:89:AB", 1000, false);
final SetSourceNatCommand cmd = new SetSourceNatCommand(ip, true);
cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME);
return cmd;
}
use of com.cloud.agent.api.to.IpAddressTO in project cloudstack by apache.
the class Ovm3VirtualRoutingResourceTest method getIp.
private IpAddressTO[] getIp(String mac) {
String[] br = xen.getVmNicBridge().split("[.]");
List<IpAddressTO> ips = new ArrayList<IpAddressTO>();
IpAddressTO ip = new IpAddressTO(1, routerip, true, true, true, "vlan://" + br[1], "64.1.1.1", "255.255.255.0", mac, 1000, false);
ip.setTrafficType(TrafficType.Public);
ips.add(ip);
IpAddressTO[] ipArray = ips.toArray(new IpAddressTO[ips.size()]);
return ipArray;
}
use of com.cloud.agent.api.to.IpAddressTO in project cloudstack by apache.
the class VmwareResource method prepareNetworkElementCommand.
protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) {
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
String routerIp = getRouterSshControlIp(cmd);
IpAddressTO pubIp = cmd.getIpAddress();
try {
int ethDeviceNum = findRouterEthDeviceIndex(routerName, routerIp, pubIp.getVifMacAddress());
pubIp.setNicDevId(ethDeviceNum);
} catch (Exception e) {
String msg = "Prepare Ip SNAT failure due to " + e.toString();
s_logger.error(msg, e);
return new ExecutionResult(false, e.toString());
}
return new ExecutionResult(true, null);
}
Aggregations