use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase in project genius by opendaylight.
the class SouthboundUtils method addTunnelPortToBridge.
private void addTunnelPortToBridge(IfTunnel ifTunnel, InstanceIdentifier<?> bridgeIid, Interface iface, String portName) {
LOG.debug("adding tunnel port {} to bridge {}", portName, bridgeIid);
Class<? extends InterfaceTypeBase> type = TUNNEL_TYPE_MAP.get(ifTunnel.getTunnelInterfaceType());
if (type == null) {
LOG.warn("Unknown Tunnel Type obtained while creating interface: {}", iface);
return;
}
int vlanId = 0;
IfL2vlan ifL2vlan = iface.getAugmentation(IfL2vlan.class);
if (ifL2vlan != null && ifL2vlan.getVlanId() != null) {
vlanId = ifL2vlan.getVlanId().getValue();
}
Map<String, String> options = Maps.newHashMap();
// Options common to any kind of tunnel
if (BooleanUtils.isTrue(ifTunnel.isTunnelSourceIpFlow())) {
options.put(TUNNEL_OPTIONS_LOCAL_IP, TUNNEL_OPTIONS_VALUE_FLOW);
} else {
IpAddress localIp = ifTunnel.getTunnelSource();
options.put(TUNNEL_OPTIONS_LOCAL_IP, String.valueOf(localIp.getValue()));
}
if (BooleanUtils.isTrue(ifTunnel.isTunnelRemoteIpFlow())) {
options.put(TUNNEL_OPTIONS_REMOTE_IP, TUNNEL_OPTIONS_VALUE_FLOW);
} else {
IpAddress remoteIp = ifTunnel.getTunnelDestination();
options.put(TUNNEL_OPTIONS_REMOTE_IP, String.valueOf(remoteIp.getValue()));
}
// Specific options for each type of tunnel
if (ifTunnel.getTunnelInterfaceType().equals(TunnelTypeMplsOverGre.class)) {
options.put(TUNNEL_OPTIONS_PKT_TYPE, TUNNEL_OPTIONS_VALUE_LEGACY_L3);
} else {
options.put(TUNNEL_OPTIONS_KEY, TUNNEL_OPTIONS_VALUE_FLOW);
}
if (ifTunnel.getTunnelInterfaceType().equals(TunnelTypeVxlanGpe.class)) {
options.put(TUNNEL_OPTIONS_EXTS, TUNNEL_OPTIONS_VALUE_GPE);
options.put(TUNNEL_OPTIONS_NSI, TUNNEL_OPTIONS_VALUE_FLOW);
options.put(TUNNEL_OPTIONS_NSP, TUNNEL_OPTIONS_VALUE_FLOW);
options.put(TUNNEL_OPTIONS_NSHC1, TUNNEL_OPTIONS_VALUE_FLOW);
options.put(TUNNEL_OPTIONS_NSHC2, TUNNEL_OPTIONS_VALUE_FLOW);
options.put(TUNNEL_OPTIONS_NSHC3, TUNNEL_OPTIONS_VALUE_FLOW);
options.put(TUNNEL_OPTIONS_NSHC4, TUNNEL_OPTIONS_VALUE_FLOW);
// VxLAN-GPE interfaces will not use the default UDP port to avoid
// problems with other meshes
options.put(TUNNEL_OPTIONS_DESTINATION_PORT, TUNNEL_OPTIONS_VALUE_GPE_DESTINATION_PORT);
}
if (ifTunnel.getTunnelOptions() != null) {
for (TunnelOptions tunOpt : ifTunnel.getTunnelOptions()) {
options.putIfAbsent(tunOpt.getTunnelOption(), tunOpt.getValue());
}
}
addTerminationPoint(bridgeIid, portName, vlanId, type, options, ifTunnel);
}
Aggregations