Package com.cloud.agent.api

Examples of com.cloud.agent.api.CreateVnsPortAnswer


        PortData.Port port = mock(PortData.Port.class);
        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
        assertTrue(cntka.getResult());
    }
View Full Code Here


        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");
        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (PortData)any());

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
        assertFalse(cntka.getResult());
    }
View Full Code Here

        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");
        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (AttachmentData)any());

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
        assertFalse(cntka.getResult());
        verify(_bigswitchVnsApi, atLeastOnce()).deletePort((String) any(), (String) any(), (String) any());
    }
View Full Code Here

            } catch (BigSwitchVnsApiException ex) {
                s_logger.warn("modifyPortAttachment failed after switchport was created, removing switchport");
                _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid());
                throw (ex); // Rethrow the original exception
            }
            return new CreateVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " created");
        } catch (BigSwitchVnsApiException e) {
                if (numRetries > 0) {
                        return retry(cmd, --numRetries);
                }
                else {
                        return new CreateVnsPortAnswer(cmd, e);
                }
        }
    }
View Full Code Here

                network.getBroadcastUri().getSchemeSpecificPart(),
                vm.getUuid(),
                tenantId,
                nic.getName(),
                mac);
        CreateVnsPortAnswer answer = (CreateVnsPortAnswer) _agentMgr
                .easySend(bigswitchVnsHost.getId(), cmd);

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

        return true;
View Full Code Here

        PortData.Port port = mock(PortData.Port.class);
        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
        assertTrue(cntka.getResult());
    }
View Full Code Here

        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");
        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (PortData)any());

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
        assertFalse(cntka.getResult());
    }
View Full Code Here

        when(portdata.getPort()).thenReturn(port);
        when(port.getId()).thenReturn("eeee");
        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (AttachmentData)any());

        CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
        CreateVnsPortAnswer cntka = (CreateVnsPortAnswer)_resource.executeRequest(cntkc);
        assertFalse(cntka.getResult());
        verify(_bigswitchVnsApi, atLeastOnce()).deletePort((String)any(), (String)any(), (String)any());
    }
View Full Code Here

            } catch (BigSwitchVnsApiException ex) {
                s_logger.warn("modifyPortAttachment failed after switchport was created, removing switchport");
                _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid());
                throw (ex); // Rethrow the original exception
            }
            return new CreateVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " created");
        } catch (BigSwitchVnsApiException e) {
            if (numRetries > 0) {
                return retry(cmd, --numRetries);
            } else {
                return new CreateVnsPortAnswer(cmd, e);
            }
        }
    }
View Full Code Here

        }
        BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
        HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());

        CreateVnsPortCommand cmd = new CreateVnsPortCommand(BroadcastDomainType.getValue(network.getBroadcastUri()), vm.getUuid(), tenantId, nic.getName(), mac);
        CreateVnsPortAnswer answer = (CreateVnsPortAnswer)_agentMgr.easySend(bigswitchVnsHost.getId(), cmd);

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

        return true;
View Full Code Here

TOP

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

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.