Package com.cloud.agent.api

Examples of com.cloud.agent.api.ConfigureStaticNatRulesOnLogicalRouterAnswer


            throw ex; // Rethrow original exception
          }
         
        }
        }
        return new ConfigureStaticNatRulesOnLogicalRouterAnswer(cmd, true, cmd.getRules().size() +" StaticNat rules applied");
        } catch (NiciraNvpApiException e) {
          if (numRetries > 0) {
            return retry(cmd, --numRetries);
          }
          else {
            return new ConfigureStaticNatRulesOnLogicalRouterAnswer(cmd, e);
          }
        }
    }
View Full Code Here


            staticNatRules.add(ruleTO);
        }

        ConfigureStaticNatRulesOnLogicalRouterCommand cmd =
                new ConfigureStaticNatRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), staticNatRules);
        ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd);

        return answer.getResult();
    }
View Full Code Here

    NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
    rulepair[0].setUuid(UUID.randomUUID());
    rulepair[1].setUuid(UUID.randomUUID());
    when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
   
    ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
   
    assertTrue(a.getResult());
    verify(_nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
      @Override
      public boolean matches(Object argument) {
        NatRule rule = (NatRule) argument;
        if (rule.getType().equals("DestinationNatRule") &&
View Full Code Here

    NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
    when(storedRules.getResultCount()).thenReturn(2);
    when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
    when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
   
    ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
   
    assertTrue(a.getResult());
    verify(_nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
      @Override
      public boolean matches(Object argument) {
        NatRule rule = (NatRule) argument;
        if (rule.getType().equals("DestinationNatRule") &&
View Full Code Here

    NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
    when(storedRules.getResultCount()).thenReturn(2);
    when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
    when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
   
    ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
   
    assertTrue(a.getResult());
    verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
      @Override
      public boolean matches(Object argument) {
        UUID uuid = (UUID) argument;
        if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) {
View Full Code Here

    @SuppressWarnings("unchecked")
    NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
    when(storedRules.getResultCount()).thenReturn(0);
    when(_nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);
   
    ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
   
    assertFalse(a.getResult());
    verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
  }
View Full Code Here

                        throw ex; // Rethrow original exception
                    }

                }
            }
            return new ConfigureStaticNatRulesOnLogicalRouterAnswer(cmd, true, cmd.getRules().size() + " StaticNat rules applied");
        } catch (NiciraNvpApiException e) {
            if (numRetries > 0) {
                return retry(cmd, --numRetries);
            } else {
                return new ConfigureStaticNatRulesOnLogicalRouterAnswer(cmd, e);
            }
        }
    }
View Full Code Here

        final NatRule[] rulepair = resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
        rulepair[0].setUuid(UUID.randomUUID());
        rulepair[1].setUuid(UUID.randomUUID());
        when(nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);

        final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd);

        assertTrue(a.getResult());
        verify(nvpApi, atLeast(2)).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(final Object argument) {
                final NatRule rule = (NatRule)argument;
                if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
View Full Code Here

        NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
        when(storedRules.getResultCount()).thenReturn(2);
        when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);

        final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd);

        assertTrue(a.getResult());
        verify(nvpApi, never()).createLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<NatRule>() {
            @Override
            public boolean matches(final Object argument) {
                final NatRule rule = (NatRule)argument;
                if (rule.getType().equals("DestinationNatRule") && ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
View Full Code Here

        NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
        when(storedRules.getResultCount()).thenReturn(2);
        when(storedRules.getResults()).thenReturn(Arrays.asList(rulepair));
        when(nvpApi.findNatRulesByLogicalRouterUuid("aaaaa")).thenReturn(storedRules);

        final ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer)resource.executeRequest(cmd);

        assertTrue(a.getResult());
        verify(nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
            @Override
            public boolean matches(final Object argument) {
                final UUID uuid = (UUID)argument;
                if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) {
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.ConfigureStaticNatRulesOnLogicalRouterAnswer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.