Search in sources :

Example 6 with VspAclRule

use of net.nuage.vsp.acs.client.api.model.VspAclRule 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 7 with VspAclRule

use of net.nuage.vsp.acs.client.api.model.VspAclRule 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)

Aggregations

VspAclRule (net.nuage.vsp.acs.client.api.model.VspAclRule)7 VspNetwork (net.nuage.vsp.acs.client.api.model.VspNetwork)4 Answer (com.cloud.agent.api.Answer)3 ApplyAclRuleVspCommand (com.cloud.agent.api.element.ApplyAclRuleVspCommand)3 Test (org.junit.Test)3 NuageTest (com.cloud.NuageTest)2 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)2 HostVO (com.cloud.host.HostVO)2 IPAddressVO (com.cloud.network.dao.IPAddressVO)2 ImplementVspCommand (com.cloud.agent.api.element.ImplementVspCommand)1 FirewallRule (com.cloud.network.rules.FirewallRule)1 FirewallRuleVO (com.cloud.network.rules.FirewallRuleVO)1 NetworkACLItem (com.cloud.network.vpc.NetworkACLItem)1 NetworkOfferingVO (com.cloud.offerings.NetworkOfferingVO)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1 VspDhcpDomainOption (net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption)1 InternalIdentity (org.apache.cloudstack.api.InternalIdentity)1