Search in sources :

Example 96 with RouterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.RouterId in project netvirt by opendaylight.

the class NatRpcServiceImpl method getNatTranslationsOnVpn.

@Override
public ListenableFuture<RpcResult<GetNatTranslationsOnVpnOutput>> getNatTranslationsOnVpn(GetNatTranslationsOnVpnInput input) {
    RpcResultBuilder<GetNatTranslationsOnVpnOutput> rpcResultBuilder = null;
    List<Uuid> routerUuidList = NatUtil.getRouterUuIdsForVpn(dataBroker, input.getVpnUuid());
    if (routerUuidList.isEmpty()) {
        String errMsg = String.format("404 Not Found - Invalid external vpn {%s} provided", input.getVpnUuid().getValue());
        rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnVpnOutput>failed().withError(RpcError.ErrorType.APPLICATION, errMsg);
        return rpcResultBuilder.buildFuture();
    }
    List<RouterNat> natRouterList = new ArrayList<>();
    for (Uuid routerUuid : routerUuidList) {
        Uint32 routerId = NatUtil.getVpnId(dataBroker, routerUuid.getValue());
        if (routerId == NatConstants.INVALID_ID) {
            LOG.warn("getNatTranslationsOnVpn : Invalid RouterID found {}", routerId);
            continue;
        }
        natRouterList.addAll(constructNatInformation(routerUuid, routerId));
    }
    GetNatTranslationsOnVpnOutputBuilder output = new GetNatTranslationsOnVpnOutputBuilder().setRouterNat(natRouterList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : GetNatTranslationsOnVpnOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnVpnOutput) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) GetNatTranslationsOnVpnOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnVpnOutputBuilder) RouterNat(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.nat.output.RouterNat) ArrayList(java.util.ArrayList) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Example 97 with RouterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.RouterId in project netvirt by opendaylight.

the class NatRpcServiceImpl method getNatTranslationsOnRouter.

@Override
public ListenableFuture<RpcResult<GetNatTranslationsOnRouterOutput>> getNatTranslationsOnRouter(GetNatTranslationsOnRouterInput input) {
    RpcResultBuilder<GetNatTranslationsOnRouterOutput> rpcResultBuilder = null;
    Uint32 routerId = NatUtil.getVpnId(dataBroker, input.getRouterUuid().getValue());
    if (routerId == NatConstants.INVALID_ID) {
        String errMsg = String.format("404 Not Found - No Router found with UUID {%s}", input.getRouterUuid().getValue());
        rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnRouterOutput>failed().withError(RpcError.ErrorType.APPLICATION, errMsg);
        return rpcResultBuilder.buildFuture();
    }
    List<RouterNat> routerNatList = constructNatInformation(input.getRouterUuid(), routerId);
    GetNatTranslationsOnRouterOutputBuilder output = new GetNatTranslationsOnRouterOutputBuilder().setRouterNat(routerNatList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return rpcResultBuilder.buildFuture();
}
Also used : GetNatTranslationsOnRouterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutput) RouterNat(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.nat.output.RouterNat) GetNatTranslationsOnRouterOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutputBuilder) Uint32(org.opendaylight.yangtools.yang.common.Uint32)

Example 98 with RouterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.RouterId in project netvirt by opendaylight.

the class BgpConfigurationManager method startBgp.

public void startBgp(long as, String routerId, int spt, boolean fbit) {
    IpAddress rid = routerId == null ? null : IpAddressBuilder.getDefaultInstance(routerId);
    Long staleTime = (long) spt;
    InstanceIdentifier.InstanceIdentifierBuilder<AsId> iib = InstanceIdentifier.builder(Bgp.class).child(AsId.class);
    InstanceIdentifier<AsId> iid = iib.build();
    AsId dto = new AsIdBuilder().setLocalAs(as).setRouterId(rid).setStalepathTime(staleTime).setAnnounceFbit(fbit).build();
    update(iid, dto);
}
Also used : AsId(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.AsId) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Bgp(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp) AsIdBuilder(org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.AsIdBuilder)

Example 99 with RouterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.RouterId in project netvirt by opendaylight.

the class NeutronvpnUtils method getVpnInstanceRouterIdsList.

public static List<RouterIds> getVpnInstanceRouterIdsList(List<Uuid> routerIds) {
    List<RouterIds> listRouterIds = new ArrayList<>();
    for (Uuid routerId : routerIds) {
        final RouterIds routerIdInstance = getvpnInstanceRouterIds(routerId);
        listRouterIds.add(routerIdInstance);
    }
    return listRouterIds;
}
Also used : RouterIds(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.vpn.instance.RouterIds) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ArrayList(java.util.ArrayList)

Example 100 with RouterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.RouterId in project netvirt by opendaylight.

the class NeutronvpnUtils method getNeutronRouter.

protected Router getNeutronRouter(Uuid routerId) {
    Router router = routerMap.get(routerId);
    if (router != null) {
        return router;
    }
    Optional<Router> rtr = read(LogicalDatastoreType.CONFIGURATION, getNeutronRouterIid(routerId));
    if (rtr.isPresent()) {
        router = rtr.get();
    }
    return router;
}
Also used : Router(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router)

Aggregations

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)152 ArrayList (java.util.ArrayList)78 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)76 ExecutionException (java.util.concurrent.ExecutionException)63 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)44 ProviderTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)43 Routers (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers)34 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)34 BigInteger (java.math.BigInteger)33 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)33 ExternalIps (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps)29 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)29 Logger (org.slf4j.Logger)27 LoggerFactory (org.slf4j.LoggerFactory)27 Inject (javax.inject.Inject)25 Singleton (javax.inject.Singleton)25 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)25 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)24 List (java.util.List)23 TransactionCommitFailedException (org.opendaylight.mdsal.common.api.TransactionCommitFailedException)23