Search in sources :

Example 11 with VspNetwork

use of net.nuage.vsp.acs.client.api.model.VspNetwork in project cloudstack by apache.

the class CommandsTest method testApplyAclRuleVspCommandGsonEquals.

@Test
public void testApplyAclRuleVspCommandGsonEquals() throws IllegalAccessException, InvocationTargetException, InstantiationException {
    VspNetwork vspNetwork = new VspNetwork.Builder().id(1).uuid("uuid").name("name").cidr("192.168.1.0/24").gateway("192.168.1.1").build();
    VspAclRule aclRule = new VspAclRule.Builder().action(VspAclRule.ACLAction.Allow).uuid("uuid").trafficType(VspAclRule.ACLTrafficType.Egress).protocol(Protocol.TCP).startPort(80).endPort(80).priority(1).state(VspAclRule.ACLState.Active).build();
    ApplyAclRuleVspCommand before = new ApplyAclRuleVspCommand(VspAclRule.ACLType.NetworkACL, vspNetwork, Arrays.asList(aclRule), false);
    ApplyAclRuleVspCommand after = serializeAndDeserialize(before);
    Assert.assertThat(after.getAclRules().get(0).getProtocol().hasPort(), is(Protocol.TCP.hasPort()));
}
Also used : ApplyAclRuleVspCommand(com.cloud.agent.api.element.ApplyAclRuleVspCommand) VspAclRule(net.nuage.vsp.acs.client.api.model.VspAclRule) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) Test(org.junit.Test)

Example 12 with VspNetwork

use of net.nuage.vsp.acs.client.api.model.VspNetwork in project cloudstack by apache.

the class NuageVspResourceTest method testImplementNetworkVspCommand.

@Test
public void testImplementNetworkVspCommand() throws Exception {
    _resource.configure("NuageVspResource", _hostDetails);
    VspNetwork vspNetwork = buildVspNetwork();
    VspDhcpDomainOption vspDhcpOptions = buildspDhcpDomainOption();
    ImplementNetworkVspCommand cmd = new ImplementNetworkVspCommand(vspNetwork, vspDhcpOptions);
    com.cloud.agent.api.Answer implNtwkAns = _resource.executeRequest(cmd);
    assertTrue(implNtwkAns.getResult());
    verify(_mockNuageVspGuruClient).implement(vspNetwork, vspDhcpOptions);
}
Also used : ImplementNetworkVspCommand(com.cloud.agent.api.guru.ImplementNetworkVspCommand) VspDhcpDomainOption(net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption) Answer(com.cloud.agent.api.Answer) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) NuageTest(com.cloud.NuageTest) Test(org.junit.Test)

Example 13 with VspNetwork

use of net.nuage.vsp.acs.client.api.model.VspNetwork in project cloudstack by apache.

the class NuageVspEntityBuilderTest method testBuildVspNetwork.

@Test
public void testBuildVspNetwork() {
    VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedL2Network);
    validateVspNetwork(vspNetwork, true, false, false, false, "IsolatedDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedL2Network);
    validateVspNetwork(vspNetwork, true, false, false, false, "IsolatedDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedNetwork);
    validateVspNetwork(vspNetwork, false, true, false, false, "IsolatedDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedNetwork);
    validateVspNetwork(vspNetwork, false, true, false, false, "IsolatedDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedVpcNetwork);
    validateVspNetwork(vspNetwork, false, false, true, false, "VpcDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedVpcNetwork);
    validateVspNetwork(vspNetwork, false, false, true, false, "VpcDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedSharedNetwork);
    validateVspNetwork(vspNetwork, false, false, false, true, "SharedDomainTemplate");
    vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(_mockedSharedNetwork);
    validateVspNetwork(vspNetwork, false, false, false, true, "SharedDomainTemplate");
}
Also used : VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) NuageTest(com.cloud.NuageTest) Test(org.junit.Test)

Example 14 with VspNetwork

use of net.nuage.vsp.acs.client.api.model.VspNetwork in project cloudstack by apache.

the class NuageVspResourceTest method testApplyAclRuleVspCommand.

@Test
public void testApplyAclRuleVspCommand() throws Exception {
    _resource.configure("NuageVspResource", _hostDetails);
    VspNetwork vspNetwork = buildVspNetwork();
    List<VspAclRule> vspAclRules = Lists.newArrayList(buildVspAclRule());
    ApplyAclRuleVspCommand cmd = new ApplyAclRuleVspCommand(VspAclRule.ACLType.NetworkACL, vspNetwork, vspAclRules, false);
    Answer applyAclAns = _resource.executeRequest(cmd);
    assertTrue(applyAclAns.getResult());
}
Also used : Answer(com.cloud.agent.api.Answer) ApplyAclRuleVspCommand(com.cloud.agent.api.element.ApplyAclRuleVspCommand) VspAclRule(net.nuage.vsp.acs.client.api.model.VspAclRule) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) NuageTest(com.cloud.NuageTest) Test(org.junit.Test)

Example 15 with VspNetwork

use of net.nuage.vsp.acs.client.api.model.VspNetwork 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());
}
Also used : Answer(com.cloud.agent.api.Answer) DeallocateVmVspCommand(com.cloud.agent.api.guru.DeallocateVmVspCommand) VspVm(net.nuage.vsp.acs.client.api.model.VspVm) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) VspNic(net.nuage.vsp.acs.client.api.model.VspNic) NuageTest(com.cloud.NuageTest) Test(org.junit.Test)

Aggregations

VspNetwork (net.nuage.vsp.acs.client.api.model.VspNetwork)19 Answer (com.cloud.agent.api.Answer)14 Test (org.junit.Test)8 NuageTest (com.cloud.NuageTest)7 HostVO (com.cloud.host.HostVO)7 InsufficientVirtualNetworkCapacityException (com.cloud.exception.InsufficientVirtualNetworkCapacityException)5 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)4 NicVO (com.cloud.vm.NicVO)4 VspAclRule (net.nuage.vsp.acs.client.api.model.VspAclRule)4 VspNic (net.nuage.vsp.acs.client.api.model.VspNic)4 VspStaticNat (net.nuage.vsp.acs.client.api.model.VspStaticNat)4 VspVm (net.nuage.vsp.acs.client.api.model.VspVm)4 ApplyAclRuleVspCommand (com.cloud.agent.api.element.ApplyAclRuleVspCommand)3 VlanVO (com.cloud.dc.VlanVO)3 IPAddressVO (com.cloud.network.dao.IPAddressVO)3 AccountVO (com.cloud.user.AccountVO)3 VspDhcpDomainOption (net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption)3 VspDhcpVMOption (net.nuage.vsp.acs.client.api.model.VspDhcpVMOption)3 ApplyStaticNatVspCommand (com.cloud.agent.api.element.ApplyStaticNatVspCommand)2 DeallocateVmVspCommand (com.cloud.agent.api.guru.DeallocateVmVspCommand)2