Search in sources :

Example 1 with TunnelOptionsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsBuilder in project genius by opendaylight.

the class ItmUtils method buildTunnelOptions.

public static List<TunnelOptions> buildTunnelOptions(TunnelEndPoints tep, ItmConfig itmConfig) {
    List<TunnelOptions> tunOptions = new ArrayList<>();
    String tos = tep.getOptionTunnelTos();
    if (tos == null) {
        tos = itmConfig.getDefaultTunnelTos();
    }
    /* populate tos option only if its not default value of 0 */
    if (tos != null && !tos.equals("0")) {
        TunnelOptionsBuilder optionsBuilder = new TunnelOptionsBuilder();
        optionsBuilder.setKey(new TunnelOptionsKey("tos"));
        optionsBuilder.setTunnelOption("tos");
        optionsBuilder.setValue(tos);
        tunOptions.add(optionsBuilder.build());
    }
    if (tep.getTunnelType() == TunnelTypeVxlan.class && itmConfig.isGpeExtensionEnabled()) {
        TunnelOptionsBuilder optionsBuilder = new TunnelOptionsBuilder();
        optionsBuilder.setKey(new TunnelOptionsKey("exts"));
        optionsBuilder.setTunnelOption("exts");
        optionsBuilder.setValue("gpe");
        tunOptions.add(optionsBuilder.build());
    }
    return tunOptions.isEmpty() ? null : tunOptions;
}
Also used : TunnelOptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsBuilder) TunnelOptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsKey) ArrayList(java.util.ArrayList) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)

Aggregations

ArrayList (java.util.ArrayList)1 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)1 TunnelOptions (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions)1 TunnelOptionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsBuilder)1 TunnelOptionsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsKey)1