Package org.apache.cloudstack.network.contrail.model

Examples of org.apache.cloudstack.network.contrail.model.VirtualNetworkModel


        }
        return true;
    }

    public boolean deleteFloatingIp(PublicIpAddress ip) {
        VirtualNetworkModel vnModel = lookupPublicNetworkModel();
        assert vnModel != null : "public network model is null";
        FloatingIpPoolModel fipPoolModel = vnModel.getFipPoolModel();
        FloatingIpModel fipModel = fipPoolModel.getFloatingIpModel(ip.getUuid());
        if (fipModel != null) {
            try {
                fipModel.destroy(getModelController());
            } catch (IOException ex) {
                s_logger.warn("floating ip delete", ex);
                return false;
            }
            fipPoolModel.removeSuccessor(fipModel);
            if (!fipPoolModel.hasDescendents()) {
                try {
                    fipPoolModel.delete(getModelController());
                    vnModel.setFipPoolModel(null);
                } catch (IOException e) {
                    return false;
                }
            }
        }
View Full Code Here


    @Test
    public void testDBLookup() {
        ModelDatabase db = new ModelDatabase();
        NetworkVO network = Mockito.mock(NetworkVO.class);
        VirtualNetworkModel storageModel = new VirtualNetworkModel(network, null, ContrailManager.managementNetworkName,
                TrafficType.Storage);
        db.getVirtualNetworks().add(storageModel);
        VirtualNetworkModel mgmtModel = new VirtualNetworkModel(network, null, ContrailManager.managementNetworkName,
                TrafficType.Management);
        db.getVirtualNetworks().add(mgmtModel);
        VirtualNetworkModel guestModel1 = new VirtualNetworkModel(network, UUID.randomUUID().toString(), "test",
                TrafficType.Guest);
        db.getVirtualNetworks().add(guestModel1);
        VirtualNetworkModel guestModel2 = new VirtualNetworkModel(network, UUID.randomUUID().toString(), "test",
                TrafficType.Guest);
        db.getVirtualNetworks().add(guestModel2);
        s_logger.debug("networks: " + db.getVirtualNetworks().size());
        assertEquals(4, db.getVirtualNetworks().size());
        assertSame(storageModel, db.lookupVirtualNetwork(null, storageModel.getName(), TrafficType.Storage));
        assertSame(mgmtModel, db.lookupVirtualNetwork(null, mgmtModel.getName(), TrafficType.Management));
        assertSame(guestModel1, db.lookupVirtualNetwork(guestModel1.getUuid(), null, TrafficType.Guest));
        assertSame(guestModel2, db.lookupVirtualNetwork(guestModel2.getUuid(), null, TrafficType.Guest));
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.network.contrail.model.VirtualNetworkModel

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.