Package org.midonet.client.resource

Examples of org.midonet.client.resource.ResourceCollection


        // Get MidoNet bridge
        Bridge netBridge = getOrCreateNetworkBridge(network);

        // On bridge, get DHCP subnet (ensure it exists)
        ResourceCollection res = netBridge.getDhcpSubnets();

        DhcpSubnet sub = null;

        if(!res.isEmpty()){
            sub = (DhcpSubnet) res.get(0);
        } else {
            Pair<String,Integer> cidrInfo = NetUtils.getCidr(network.getCidr());
            sub = netBridge.addDhcpSubnet();

            sub.subnetLength(cidrInfo.second());
View Full Code Here


        DhcpSubnet mockSub = mock(DhcpSubnet.class);
        when(mockSub.addDhcpHost()).thenReturn(mockDhcpHost);
        when(mockSub.getDhcpHosts()).thenReturn(hosts);

        //mockSubnetCollection
        ResourceCollection mockSubnetCollection = mock(ResourceCollection.class);
        when(mockSubnetCollection.get(anyInt())).thenReturn(mockSub);

        //mockBridge
        Bridge mockBridge = mock(Bridge.class);
        when(api.addBridge().tenantId(anyString()).name(anyString()).create()).thenReturn(mockBridge);
        when(mockBridge.getDhcpSubnets()).thenReturn(mockSubnetCollection);
View Full Code Here

        // Get MidoNet bridge
        Bridge netBridge = getOrCreateNetworkBridge(network);

        // On bridge, get DHCP subnet (ensure it exists)
        ResourceCollection res = netBridge.getDhcpSubnets();

        DhcpSubnet sub = null;

        if (!res.isEmpty()) {
            sub = (DhcpSubnet)res.get(0);
        } else {
            Pair<String, Integer> cidrInfo = NetUtils.getCidr(network.getCidr());
            sub = netBridge.addDhcpSubnet();

            sub.subnetLength(cidrInfo.second());
View Full Code Here

        // Get MidoNet bridge
        Bridge netBridge = getOrCreateNetworkBridge(network);

        // On bridge, get DHCP subnet (ensure it exists)
        ResourceCollection res = netBridge.getDhcpSubnets();

        DhcpSubnet sub = null;

        if(!res.isEmpty()){
            sub = (DhcpSubnet) res.get(0);
        } else {
            Pair<String,Integer> cidrInfo = NetUtils.getCidr(network.getCidr());
            sub = netBridge.addDhcpSubnet();

            sub.subnetLength(cidrInfo.second());
View Full Code Here

TOP

Related Classes of org.midonet.client.resource.ResourceCollection

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.