Search in sources :

Example 16 with IpAddressTO

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);
}
Also used : IpAddressTO(com.cloud.agent.api.to.IpAddressTO) ExecutionResult(com.cloud.utils.ExecutionResult)

Example 17 with IpAddressTO

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;
}
Also used : IpAddressTO(com.cloud.agent.api.to.IpAddressTO) ArrayList(java.util.ArrayList) IpAssocVpcCommand(com.cloud.agent.api.routing.IpAssocVpcCommand)

Example 18 with IpAddressTO

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;
}
Also used : IpAddressTO(com.cloud.agent.api.to.IpAddressTO) SetSourceNatCommand(com.cloud.agent.api.routing.SetSourceNatCommand)

Example 19 with IpAddressTO

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;
}
Also used : IpAddressTO(com.cloud.agent.api.to.IpAddressTO) ArrayList(java.util.ArrayList)

Example 20 with IpAddressTO

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);
}
Also used : IpAddressTO(com.cloud.agent.api.to.IpAddressTO) ExecutionResult(com.cloud.utils.ExecutionResult) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException)

Aggregations

IpAddressTO (com.cloud.agent.api.to.IpAddressTO)41 ExecutionResult (com.cloud.utils.ExecutionResult)16 InternalErrorException (com.cloud.exception.InternalErrorException)14 IOException (java.io.IOException)12 ConfigurationException (javax.naming.ConfigurationException)12 IpAssocAnswer (com.cloud.agent.api.routing.IpAssocAnswer)9 IpAssocCommand (com.cloud.agent.api.routing.IpAssocCommand)8 ArrayList (java.util.ArrayList)8 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)7 URISyntaxException (java.net.URISyntaxException)7 HashMap (java.util.HashMap)7 Answer (com.cloud.agent.api.Answer)6 ConnectException (java.net.ConnectException)6 RemoteException (java.rmi.RemoteException)6 IpAssocVpcCommand (com.cloud.agent.api.routing.IpAssocVpcCommand)5 URI (java.net.URI)5 Connect (org.libvirt.Connect)5 LibvirtException (org.libvirt.LibvirtException)5 DataCenterVO (com.cloud.dc.DataCenterVO)4 ExecutionException (com.cloud.utils.exception.ExecutionException)4