Package com.cloud.agent.api

Examples of com.cloud.agent.api.DeleteLogicalSwitchAnswer


    }
   
    private Answer executeRequest(DeleteLogicalSwitchCommand cmd, int numRetries) {
        try {
            _niciraNvpApi.deleteLogicalSwitch(cmd.getLogicalSwitchUuid());
            return new DeleteLogicalSwitchAnswer(cmd, true, "Logicalswitch " + cmd.getLogicalSwitchUuid() + " deleted");
        } catch (NiciraNvpApiException e) {
          if (numRetries > 0) {
            return retry(cmd, --numRetries);
          }
          else {
            return new DeleteLogicalSwitchAnswer(cmd, e);
          }
        }
    }
View Full Code Here


        }
        NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
        HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId());
       
        DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(networkObject.getBroadcastUri().getSchemeSpecificPart());
        DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd);
       
        if (answer == null || !answer.getResult()) {
            s_logger.error ("DeleteLogicalSwitchCommand failed");
        }

        super.shutdown(profile, offering);
    }
View Full Code Here

    when(acc.getAccountName()).thenReturn("accountname");
    ReservationContext res = mock(ReservationContext.class);
    when(res.getDomain()).thenReturn(dom);
    when(res.getAccount()).thenReturn(acc);
   
    DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
    when(answer.getResult()).thenReturn(true);
     when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);   

     NetworkProfile implementednetwork = mock(NetworkProfile.class);
     when(implementednetwork.getId()).thenReturn(42L);
     when(implementednetwork.getBroadcastUri()).thenReturn(new URI("lswitch:aaaa"));
View Full Code Here

  @Test
  public void testDeleteLogicalSwitch() throws ConfigurationException, NiciraNvpApiException {
    _resource.configure("NiciraNvpResource", _parameters);
   
    DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
    DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
    assertTrue(dlsa.getResult());
  }
View Full Code Here

    _resource.configure("NiciraNvpResource", _parameters);
   
    doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalSwitch((String)any());
   
    DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
    DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer) _resource.executeRequest(dlsc);
    assertFalse(dlsa.getResult());
  }
View Full Code Here

    }

    private Answer executeRequest(final DeleteLogicalSwitchCommand cmd, int numRetries) {
        try {
            niciraNvpApi.deleteLogicalSwitch(cmd.getLogicalSwitchUuid());
            return new DeleteLogicalSwitchAnswer(cmd, true, "Logicalswitch " + cmd.getLogicalSwitchUuid() + " deleted");
        } catch (NiciraNvpApiException e) {
            if (numRetries > 0) {
                return retry(cmd, --numRetries);
            } else {
                return new DeleteLogicalSwitchAnswer(cmd, e);
            }
        }
    }
View Full Code Here

        when(acc.getAccountName()).thenReturn("accountname");
        final ReservationContext res = mock(ReservationContext.class);
        when(res.getDomain()).thenReturn(dom);
        when(res.getAccount()).thenReturn(acc);

        final DeleteLogicalSwitchAnswer answer = mock(DeleteLogicalSwitchAnswer.class);
        when(answer.getResult()).thenReturn(true);
        when(agentmgr.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);

        final NetworkProfile implementednetwork = mock(NetworkProfile.class);
        when(implementednetwork.getId()).thenReturn(NETWORK_ID);
        when(implementednetwork.getBroadcastUri()).thenReturn(new URI("lswitch:aaaa"));
View Full Code Here

    @Test
    public void testDeleteLogicalSwitch() throws ConfigurationException, NiciraNvpApiException {
        resource.configure("NiciraNvpResource", parameters);

        final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
        final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc);
        assertTrue(dlsa.getResult());
    }
View Full Code Here

        resource.configure("NiciraNvpResource", parameters);

        doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitch((String)any());

        final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
        final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc);
        assertFalse(dlsa.getResult());
    }
View Full Code Here

        }
        NiciraNvpDeviceVO niciraNvpDevice = devices.get(0);
        HostVO niciraNvpHost = hostDao.findById(niciraNvpDevice.getHostId());

        DeleteLogicalSwitchCommand cmd = new DeleteLogicalSwitchCommand(BroadcastDomainType.getValue(networkObject.getBroadcastUri()));
        DeleteLogicalSwitchAnswer answer = (DeleteLogicalSwitchAnswer)agentMgr.easySend(niciraNvpHost.getId(), cmd);

        if (answer == null || !answer.getResult()) {
            s_logger.error("DeleteLogicalSwitchCommand failed");
        }

        super.shutdown(profile, offering);
    }
View Full Code Here

TOP

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

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.