Search in sources :

Example 1 with OptionsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder 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)

Example 2 with OptionsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder in project netvirt by opendaylight.

the class TestInterfaceManager method getTunnelPortsOnBridge.

@Override
public List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(BigInteger dpnId) {
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_EXIST) {
        // Unfortunately, the getTunnelPortsOnBridge() method may return null
        return null;
    }
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_PORTS) {
        return Collections.emptyList();
    }
    OvsdbTerminationPointAugmentationBuilder tpAug = new OvsdbTerminationPointAugmentationBuilder();
    tpAug.setOfport(GeniusProviderTestParams.OF_PORT);
    if (dpnId == GeniusProviderTestParams.DPN_ID_NO_VXGPE_PORTS) {
        // Tunnel Termination Point that is NOT of type VXGPE
        tpAug.setInterfaceType(InterfaceTypeGre.class);
    } else {
        // Tunnel Termination Point that IS of type VXGPE
        tpAug.setInterfaceType(InterfaceTypeVxlan.class);
    }
    List<Options> opsList = new ArrayList<>();
    if (dpnId != GeniusProviderTestParams.DPN_ID_NO_OPTIONS) {
        OptionsBuilder opsBuilder = new OptionsBuilder();
        opsBuilder.setKey(new OptionsKey(GeniusProvider.OPTION_KEY_EXTS));
        opsBuilder.setValue(GeniusProvider.OPTION_VALUE_EXTS_GPE);
        opsList.add(opsBuilder.build());
    }
    tpAug.setOptions(opsList);
    List<OvsdbTerminationPointAugmentation> tpAugList = new ArrayList<>();
    tpAugList.add(tpAug.build());
    return tpAugList;
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) ArrayList(java.util.ArrayList) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) OptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder) OptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)

Example 3 with OptionsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder in project genius by opendaylight.

the class SouthboundUtils method addTerminationPoint.

private void addTerminationPoint(InstanceIdentifier<?> bridgeIid, String portName, int vlanId, Class<? extends InterfaceTypeBase> type, Map<String, String> options, IfTunnel ifTunnel) {
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(portName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    if (options != null) {
        List<Options> optionsList = new ArrayList<>();
        for (Map.Entry<String, String> entry : options.entrySet()) {
            OptionsBuilder optionsBuilder = new OptionsBuilder();
            optionsBuilder.setKey(new OptionsKey(entry.getKey()));
            optionsBuilder.setOption(entry.getKey());
            optionsBuilder.setValue(entry.getValue());
            optionsList.add(optionsBuilder.build());
        }
        tpAugmentationBuilder.setOptions(optionsList);
    }
    if (vlanId != 0) {
        tpAugmentationBuilder.setVlanMode(OvsdbPortInterfaceAttributes.VlanMode.Access);
        tpAugmentationBuilder.setVlanTag(new VlanId(vlanId));
    }
    if (bfdMonitoringEnabled(ifTunnel)) {
        if (isOfTunnel(ifTunnel)) {
            LOG.warn("BFD Monitoring not supported for OFTunnels");
        } else {
            List<InterfaceBfd> bfdParams = getBfdParams(ifTunnel);
            tpAugmentationBuilder.setInterfaceBfd(bfdParams);
        }
    }
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), portName);
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid));
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    batchingUtils.write(tpIid, tpBuilder.build(), BatchingUtils.EntityType.TOPOLOGY_CONFIG);
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) ArrayList(java.util.ArrayList) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) OptionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) InterfaceBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd) Map(java.util.Map) HashMap(java.util.HashMap) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) OptionsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)

Aggregations

ArrayList (java.util.ArrayList)3 TunnelOptions (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions)2 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)2 Options (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options)2 OptionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder)2 OptionsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsKey)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)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 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)1 OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)1 InterfaceBfd (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd)1 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)1 TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)1