Search in sources :

Example 1 with NeutronNetworkBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NeutronNetworkBuilder in project netvirt by opendaylight.

the class NetvirtProviderTest method getLogicalInterfacesFromNeutronNetwork.

@Test
public void getLogicalInterfacesFromNeutronNetwork() {
    // Network doesnt exist
    NeutronNetworkBuilder nwBuilder = new NeutronNetworkBuilder();
    nwBuilder.setNetworkUuid(NW_UUID_NOEXIST_STR);
    List<String> interfaces = netvirtProvider.getLogicalInterfacesFromNeutronNetwork(nwBuilder.build());
    assertTrue(interfaces.isEmpty());
    // Network exists, subnet list empty
    createNetworkMap(NW_UUID_STR);
    nwBuilder = new NeutronNetworkBuilder();
    nwBuilder.setNetworkUuid(NW_UUID_STR);
    interfaces = netvirtProvider.getLogicalInterfacesFromNeutronNetwork(nwBuilder.build());
    assertTrue(interfaces.isEmpty());
    // Network exists, subnet does not exist
    createNetworkMap(NW_UUID_STR, SUBNET_UUID_STR, false, EMPTY_STR);
    nwBuilder = new NeutronNetworkBuilder();
    nwBuilder.setNetworkUuid(NW_UUID_STR);
    interfaces = netvirtProvider.getLogicalInterfacesFromNeutronNetwork(nwBuilder.build());
    assertTrue(interfaces.isEmpty());
    // Network exists, subnet exists, no ports
    createNetworkMap(NW_UUID_STR, SUBNET_UUID_STR, true, EMPTY_STR);
    nwBuilder = new NeutronNetworkBuilder();
    nwBuilder.setNetworkUuid(NW_UUID_STR);
    interfaces = netvirtProvider.getLogicalInterfacesFromNeutronNetwork(nwBuilder.build());
    assertTrue(interfaces.isEmpty());
    // Network exists, subnet exists, port exists
    createNetworkMap(NW_UUID_STR, SUBNET_UUID_STR, true, PORT_UUID_STR);
    nwBuilder = new NeutronNetworkBuilder();
    nwBuilder.setNetworkUuid(NW_UUID_STR);
    interfaces = netvirtProvider.getLogicalInterfacesFromNeutronNetwork(nwBuilder.build());
    assertFalse(interfaces.isEmpty());
}
Also used : NeutronNetworkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NeutronNetworkBuilder) Test(org.junit.Test) ConstantSchemaAbstractDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.ConstantSchemaAbstractDataBrokerTest)

Aggregations

Test (org.junit.Test)1 ConstantSchemaAbstractDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.ConstantSchemaAbstractDataBrokerTest)1 NeutronNetworkBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NeutronNetworkBuilder)1