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;
}
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;
}
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);
}
Aggregations