Search in sources :

Example 1 with CreateLogicalEdgeFirewallCommand

use of com.cloud.agent.api.CreateLogicalEdgeFirewallCommand in project cloudstack by apache.

the class CiscoVnmcElement method createLogicalEdgeFirewall.

private boolean createLogicalEdgeFirewall(long vlanId, String gateway, String gatewayNetmask, String publicIp, String publicNetmask, List<String> publicGateways, long hostId) {
    CreateLogicalEdgeFirewallCommand cmd = new CreateLogicalEdgeFirewallCommand(vlanId, publicIp, gateway, publicNetmask, gatewayNetmask);
    for (String publicGateway : publicGateways) {
        cmd.getPublicGateways().add(publicGateway);
    }
    Answer answer = _agentMgr.easySend(hostId, cmd);
    return answer.getResult();
}
Also used : Answer(com.cloud.agent.api.Answer) CreateLogicalEdgeFirewallCommand(com.cloud.agent.api.CreateLogicalEdgeFirewallCommand)

Example 2 with CreateLogicalEdgeFirewallCommand

use of com.cloud.agent.api.CreateLogicalEdgeFirewallCommand in project cloudstack by apache.

the class CiscoVnmcResourceTest method testCreateEdgeFirewall.

@Test
public void testCreateEdgeFirewall() throws ConfigurationException, Exception {
    long vlanId = 123;
    CreateLogicalEdgeFirewallCommand cmd = new CreateLogicalEdgeFirewallCommand(vlanId, "1.2.3.4", "5.6.7.8", "255.255.255.0", "255.255.255.0");
    cmd.getPublicGateways().add("1.1.1.1");
    cmd.getPublicGateways().add("2.2.2.2");
    _resource.setConnection(_connection);
    when(_connection.createTenant(anyString())).thenReturn(true);
    when(_connection.createTenantVDC(anyString())).thenReturn(true);
    when(_connection.createTenantVDCEdgeSecurityProfile(anyString())).thenReturn(true);
    when(_connection.createTenantVDCEdgeDeviceProfile(anyString())).thenReturn(true);
    when(_connection.createTenantVDCEdgeStaticRoutePolicy(anyString())).thenReturn(true);
    when(_connection.createTenantVDCEdgeStaticRoute(anyString(), anyString(), anyString(), anyString())).thenReturn(true);
    when(_connection.associateTenantVDCEdgeStaticRoutePolicy(anyString())).thenReturn(true);
    when(_connection.createEdgeFirewall(anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(true);
    Answer answer = _resource.executeRequest(cmd);
    System.out.println(answer.getDetails());
    assertTrue(answer.getResult());
}
Also used : Answer(com.cloud.agent.api.Answer) CreateLogicalEdgeFirewallCommand(com.cloud.agent.api.CreateLogicalEdgeFirewallCommand) Test(org.junit.Test)

Aggregations

Answer (com.cloud.agent.api.Answer)2 CreateLogicalEdgeFirewallCommand (com.cloud.agent.api.CreateLogicalEdgeFirewallCommand)2 Test (org.junit.Test)1