Search in sources :

Example 66 with VlanId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId 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);
}
Also used : TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Aggregations

ArrayList (java.util.ArrayList)27 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)26 BigInteger (java.math.BigInteger)14 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)12 List (java.util.List)11 Test (org.junit.Test)11 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)10 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)10 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)10 VlanIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder)10 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)9 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)9 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 SetVlanIdActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder)6 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)6 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)6 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)6 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)6 VtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsKey)6