Search in sources :

Example 21 with Transport

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport in project bgpcep by opendaylight.

the class NeighborStateCliUtils method printTransportState.

private static void printTransportState(final Transport transport, final ShellTable table) {
    if (transport == null) {
        return;
    }
    final NeighborTransportStateAugmentation state = transport.getState().getAugmentation(NeighborTransportStateAugmentation.class);
    if (state == null) {
        return;
    }
    addHeader(table, "Transport state");
    final IpAddress remoteAddress = state.getRemoteAddress();
    final String stringRemoteAddress;
    if (remoteAddress.getIpv4Address() == null) {
        stringRemoteAddress = remoteAddress.getIpv6Address().getValue();
    } else {
        stringRemoteAddress = remoteAddress.getIpv4Address().getValue();
    }
    table.addRow().addContent("Remote Address", stringRemoteAddress);
    table.addRow().addContent("Remote Port", state.getRemotePort().getValue());
    table.addRow().addContent("Local Port", state.getLocalPort().getValue());
}
Also used : NeighborTransportStateAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborTransportStateAugmentation) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 22 with Transport

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport in project netvirt by opendaylight.

the class VpnInstanceListener method addVpnInstance.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void addVpnInstance(VpnInstance value, WriteTransaction writeConfigTxn, WriteTransaction writeOperTxn) {
    VpnAfConfig config = value.getIpv4Family();
    String vpnInstanceName = value.getVpnInstanceName();
    long vpnId = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, vpnInstanceName);
    if (vpnId == 0) {
        LOG.error("{} addVpnInstance: Unable to fetch label from Id Manager. Bailing out of adding operational" + " data for Vpn Instance {}", LOGGING_PREFIX_ADD, value.getVpnInstanceName());
        return;
    }
    LOG.info("{} addVpnInstance: VPN Id {} generated for VpnInstanceName {}", LOGGING_PREFIX_ADD, vpnId, vpnInstanceName);
    String primaryRd = VpnUtil.getPrimaryRd(value);
    org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance vpnInstanceToVpnId = VpnUtil.getVpnInstanceToVpnId(vpnInstanceName, vpnId, primaryRd);
    if (writeConfigTxn != null) {
        writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName), vpnInstanceToVpnId, WriteTransaction.CREATE_MISSING_PARENTS);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName), vpnInstanceToVpnId);
    }
    VpnIds vpnIdToVpnInstance = VpnUtil.getVpnIdToVpnInstance(vpnId, value.getVpnInstanceName(), primaryRd, VpnUtil.isBgpVpn(vpnInstanceName, primaryRd));
    if (writeConfigTxn != null) {
        writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId), vpnIdToVpnInstance, WriteTransaction.CREATE_MISSING_PARENTS);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId), vpnIdToVpnInstance);
    }
    try {
        String cachedTransType = fibManager.getConfTransType();
        if (cachedTransType.equals("Invalid")) {
            try {
                fibManager.setConfTransType("L3VPN", "VXLAN");
            } catch (Exception e) {
                LOG.error("{} addVpnInstance: Exception caught setting the L3VPN tunnel transportType for vpn {}", LOGGING_PREFIX_ADD, vpnInstanceName, e);
            }
        } else {
            LOG.debug("{} addVpnInstance: Configured tunnel transport type for L3VPN {} as {}", LOGGING_PREFIX_ADD, vpnInstanceName, cachedTransType);
        }
    } catch (Exception e) {
        LOG.error("{} addVpnInstance: Error when trying to retrieve tunnel transport type for L3VPN {}", LOGGING_PREFIX_ADD, vpnInstanceName, e);
    }
    VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder().setVrfId(primaryRd).setVpnId(vpnId).setVpnInstanceName(vpnInstanceName).setVpnState(VpnInstanceOpDataEntry.VpnState.Created).setIpv4Configured(false).setIpv6Configured(false);
    if (VpnUtil.isBgpVpn(vpnInstanceName, primaryRd)) {
        List<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget> opVpnTargetList = new ArrayList<>();
        builder.setBgpvpnType(VpnInstanceOpDataEntry.BgpvpnType.BGPVPNExternal);
        if (value.getL3vni() != null) {
            builder.setL3vni(value.getL3vni());
        }
        if (value.getType() == VpnInstance.Type.L2) {
            builder.setType(VpnInstanceOpDataEntry.Type.L2);
        }
        VpnTargets vpnTargets = config.getVpnTargets();
        if (vpnTargets != null) {
            List<VpnTarget> vpnTargetList = vpnTargets.getVpnTarget();
            if (vpnTargetList != null) {
                for (VpnTarget vpnTarget : vpnTargetList) {
                    VpnTargetBuilder vpnTargetBuilder = new VpnTargetBuilder().setKey(new VpnTargetKey(vpnTarget.getKey().getVrfRTValue())).setVrfRTType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTarget.VrfRTType.forValue(vpnTarget.getVrfRTType().getIntValue())).setVrfRTValue(vpnTarget.getVrfRTValue());
                    opVpnTargetList.add(vpnTargetBuilder.build());
                }
            }
        }
        VpnTargetsBuilder vpnTargetsBuilder = new VpnTargetsBuilder().setVpnTarget(opVpnTargetList);
        builder.setVpnTargets(vpnTargetsBuilder.build());
        List<String> rds = config.getRouteDistinguisher();
        builder.setRd(rds);
    } else {
        builder.setBgpvpnType(VpnInstanceOpDataEntry.BgpvpnType.VPN);
    }
    if (writeOperTxn != null) {
        writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd), builder.build(), true);
    } else {
        TransactionUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd), builder.build());
    }
    LOG.info("{} addVpnInstance: VpnInstanceOpData populated successfully for vpn {} rd {}", LOGGING_PREFIX_ADD, vpnInstanceName, primaryRd);
}
Also used : VpnTargetKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetKey) ArrayList(java.util.ArrayList) VpnAfConfig(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnAfConfig) VpnTarget(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.af.config.vpntargets.VpnTarget) VpnTargetBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpntargets.VpnTargetBuilder) VpnInstanceOpDataEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryBuilder) VpnIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds) VpnTargets(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.af.config.VpnTargets) ExecutionException(java.util.concurrent.ExecutionException) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) VpnTargetsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnTargetsBuilder)

Example 23 with Transport

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport in project netvirt by opendaylight.

the class ElanDpnToTransportZoneListener method remove.

@Override
protected void remove(InstanceIdentifier<DpnInterfaces> key, DpnInterfaces dataObjectModification) {
    LOG.debug("Elan dpn {} delete detected, deleting transport zones", dataObjectModification.getDpId());
    BigInteger dpId = dataObjectModification.getDpId();
    String elanInstanceName = key.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
    if (!ElanUtils.isVxlanNetworkOrVxlanSegment(elanInstanceCache.get(elanInstanceName).orNull())) {
        LOG.debug("ElanInstance {} is not vxlan network, nothing to do", elanInstanceName);
        return;
    }
    LOG.debug("Deleting tz for elanInstance {} dpId {}", elanInstanceName, dpId);
    transportZoneNotificationUtil.deleteTransportZone(elanInstanceName, dpId);
}
Also used : ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) BigInteger(java.math.BigInteger)

Example 24 with Transport

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport in project netvirt by opendaylight.

the class NexthopManager method createConfTransportType.

private ConfTransportTypeL3vpn createConfTransportType(String type) {
    ConfTransportTypeL3vpn confTransType;
    switch(type) {
        case ITMConstants.TUNNEL_TYPE_GRE:
            confTransType = new ConfTransportTypeL3vpnBuilder().setTransportType(TunnelTypeGre.class).build();
            LOG.trace("Setting the confTransportType to GRE.");
            break;
        case ITMConstants.TUNNEL_TYPE_VXLAN:
            confTransType = new ConfTransportTypeL3vpnBuilder().setTransportType(TunnelTypeVxlan.class).build();
            LOG.trace("Setting the confTransportType to VxLAN.");
            break;
        default:
            LOG.trace("Invalid transport type {} passed to Config DS ", type);
            confTransType = null;
            break;
    }
    return confTransType;
}
Also used : ConfTransportTypeL3vpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.ConfTransportTypeL3vpnBuilder) ConfTransportTypeL3vpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.ConfTransportTypeL3vpn)

Example 25 with Transport

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport in project openflowplugin by opendaylight.

the class SwitchConnectionProviderImpl method createAndConfigureServer.

private ServerFacade createAndConfigureServer() {
    LOG.debug("Configuring ..");
    ServerFacade server = null;
    final ChannelInitializerFactory factory = new ChannelInitializerFactory();
    factory.setSwitchConnectionHandler(switchConnectionHandler);
    factory.setSwitchIdleTimeout(connConfig.getSwitchIdleTimeout());
    factory.setTlsConfig(connConfig.getTlsConfiguration());
    factory.setSerializationFactory(serializationFactory);
    factory.setDeserializationFactory(deserializationFactory);
    factory.setUseBarrier(connConfig.useBarrier());
    factory.setChannelOutboundQueueSize(connConfig.getChannelOutboundQueueSize());
    final TransportProtocol transportProtocol = (TransportProtocol) connConfig.getTransferProtocol();
    // Check if Epoll native transport is available.
    // TODO : Add option to disable Epoll.
    boolean isEpollEnabled = Epoll.isAvailable();
    if (TransportProtocol.TCP.equals(transportProtocol) || TransportProtocol.TLS.equals(transportProtocol)) {
        server = new TcpHandler(connConfig.getAddress(), connConfig.getPort());
        final TcpChannelInitializer channelInitializer = factory.createPublishingChannelInitializer();
        ((TcpHandler) server).setChannelInitializer(channelInitializer);
        ((TcpHandler) server).initiateEventLoopGroups(connConfig.getThreadConfiguration(), isEpollEnabled);
        final EventLoopGroup workerGroupFromTcpHandler = ((TcpHandler) server).getWorkerGroup();
        connectionInitializer = new TcpConnectionInitializer(workerGroupFromTcpHandler, isEpollEnabled);
        connectionInitializer.setChannelInitializer(channelInitializer);
        connectionInitializer.run();
    } else if (TransportProtocol.UDP.equals(transportProtocol)) {
        server = new UdpHandler(connConfig.getAddress(), connConfig.getPort());
        ((UdpHandler) server).initiateEventLoopGroups(connConfig.getThreadConfiguration(), isEpollEnabled);
        ((UdpHandler) server).setChannelInitializer(factory.createUdpChannelInitializer());
    } else {
        throw new IllegalStateException("Unknown transport protocol received: " + transportProtocol);
    }
    server.setThreadConfig(connConfig.getThreadConfiguration());
    return server;
}
Also used : EventLoopGroup(io.netty.channel.EventLoopGroup) TransportProtocol(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol)

Aggregations

TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)16 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)14 ArrayList (java.util.ArrayList)11 TepsInNotHostedTransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)11 Subnets (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets)10 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)9 UnknownVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVteps)9 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 BigInteger (java.math.BigInteger)7 Test (org.junit.Test)7 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)5 TepsInNotHostedTransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZoneKey)5 HashMap (java.util.HashMap)4 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)4 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)4 HwVtep (org.opendaylight.genius.itm.confighelpers.HwVtep)4 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)4 UnknownVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVtepsKey)4 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)4 DeviceVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps)4