Search in sources :

Example 1 with DevicesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.DevicesBuilder in project netvirt by opendaylight.

the class L2gwBuilders method buildL2gw.

public L2gateway buildL2gw(String l2gwName, String deviceName, List<String> intfNames) {
    final L2gatewayBuilder l2gatewayBuilder = new L2gatewayBuilder();
    String uuid = UUID.nameUUIDFromBytes(l2gwName.getBytes()).toString();
    // String tenantUuid = UUID.fromString(ELAN1).toString();
    l2gatewayBuilder.setUuid(new Uuid(uuid));
    l2gatewayBuilder.setTenantId(new Uuid(ExpectedObjects.ELAN1));
    final List<Devices> devices = new ArrayList<>();
    final DevicesBuilder deviceBuilder = new DevicesBuilder();
    final List<Interfaces> interfaces = new ArrayList<>();
    for (String intfName : intfNames) {
        final InterfacesBuilder interfacesBuilder = new InterfacesBuilder();
        interfacesBuilder.setInterfaceName(intfName);
        interfacesBuilder.setSegmentationIds(new ArrayList<>());
        interfaces.add(interfacesBuilder.build());
    }
    deviceBuilder.setDeviceName(deviceName);
    deviceBuilder.setUuid(new Uuid(uuid));
    deviceBuilder.setInterfaces(interfaces);
    devices.add(deviceBuilder.build());
    l2gatewayBuilder.setDevices(devices);
    return l2gatewayBuilder.build();
}
Also used : Interfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.devices.Interfaces) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ArrayList(java.util.ArrayList) DevicesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.DevicesBuilder) Devices(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices) InterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.devices.InterfacesBuilder) L2gatewayBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gatewayBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 Devices (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices)1 DevicesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.DevicesBuilder)1 Interfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.devices.Interfaces)1 InterfacesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.devices.InterfacesBuilder)1 L2gatewayBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gatewayBuilder)1