Search in sources :

Example 86 with RouterId

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

the class EROUnnumberedInterfaceSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof UnnumberedCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", subobject.getSubobjectType().getClass());
    final UnnumberedSubobject specObj = ((UnnumberedCase) subobject.getSubobjectType()).getUnnumbered();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    body.writeZero(RESERVED);
    Preconditions.checkArgument(specObj.getRouterId() != null, "RouterId is mandatory.");
    writeUnsignedInt(specObj.getRouterId(), body);
    Preconditions.checkArgument(specObj.getInterfaceId() != null, "InterfaceId is mandatory");
    writeUnsignedInt(specObj.getInterfaceId(), body);
    EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
}
Also used : UnnumberedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase) ByteBuf(io.netty.buffer.ByteBuf) UnnumberedSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.UnnumberedSubobject)

Example 87 with RouterId

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

the class RROUnnumberedInterfaceSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof UnnumberedCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", subobject.getSubobjectType().getClass());
    final UnnumberedSubobject specObj = ((UnnumberedCase) subobject.getSubobjectType()).getUnnumbered();
    final BitArray flags = new BitArray(FLAGS_SIZE);
    flags.set(LPA_F_OFFSET, subobject.isProtectionAvailable());
    flags.set(LPIU_F_OFFSET, subobject.isProtectionInUse());
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    flags.toByteBuf(body);
    body.writeZero(RESERVED);
    Preconditions.checkArgument(specObj.getRouterId() != null, "RouterId is mandatory.");
    writeUnsignedInt(specObj.getRouterId(), body);
    Preconditions.checkArgument(specObj.getInterfaceId() != null, "InterfaceId is mandatory.");
    writeUnsignedInt(specObj.getInterfaceId(), body);
    RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Also used : UnnumberedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCase) BitArray(org.opendaylight.protocol.util.BitArray) ByteBuf(io.netty.buffer.ByteBuf) UnnumberedSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.UnnumberedSubobject)

Example 88 with RouterId

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

the class NodeNlriParser method serializeRouterId.

private static CRouterIdentifier serializeRouterId(final ContainerNode descriptorsData) {
    CRouterIdentifier cRouterId = null;
    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId = descriptorsData.getChild(ROUTER_NID);
    if (maybeRouterId.isPresent()) {
        final ChoiceNode routerId = (ChoiceNode) maybeRouterId.get();
        if (routerId.getChild(ISIS_NODE_NID).isPresent()) {
            cRouterId = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
        } else if (routerId.getChild(ISIS_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
        } else if (routerId.getChild(OSPF_NODE_NID).isPresent()) {
            cRouterId = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
        } else if (routerId.getChild(OSPF_PSEUDONODE_NID).isPresent()) {
            cRouterId = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
        }
    }
    return cRouterId;
}
Also used : CRouterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument)

Example 89 with RouterId

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

the class AbstractNodeDescriptorTlvCodec method parseNodeDescriptor.

protected static NodeIdentifier parseNodeDescriptor(final ByteBuf value, final Map<QName, Object> parsedSubTlvs) {
    parsedSubTlvs.putAll(SimpleNlriTypeRegistry.getInstance().parseSubTlvs(value));
    final AsNumber asNumber = (AsNumber) parsedSubTlvs.get(AsNumTlvParser.AS_NUMBER_QNAME);
    final DomainIdentifier domainId = (DomainIdentifier) parsedSubTlvs.get(DomainIdTlvParser.DOMAIN_ID_QNAME);
    final AreaIdentifier areaId = (AreaIdentifier) parsedSubTlvs.get(AreaIdTlvParser.AREA_ID_QNAME);
    final CRouterIdentifier routerId = (CRouterIdentifier) parsedSubTlvs.get(CRouterIdentifier.QNAME);
    return new NodeIdentifier() {

        @Override
        public Class<? extends DataContainer> getImplementedInterface() {
            return NodeIdentifier.class;
        }

        @Override
        public AsNumber getAsNumber() {
            return asNumber;
        }

        @Override
        public DomainIdentifier getDomainId() {
            return domainId;
        }

        @Override
        public AreaIdentifier getAreaId() {
            return areaId;
        }

        @Override
        public CRouterIdentifier getCRouterIdentifier() {
            return routerId;
        }
    };
}
Also used : CRouterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.node.identifier.CRouterIdentifier) AreaIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.AreaIdentifier) NodeIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.NodeIdentifier) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) DomainIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.DomainIdentifier)

Example 90 with RouterId

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

the class VpnInterfaceManager method processExternalVpnInterface.

private void processExternalVpnInterface(String interfaceName, String vpnName, long vpnId, BigInteger dpId, int lportTag, WriteTransaction writeInvTxn, int addOrRemove) {
    Uuid extNetworkId;
    try {
        // vpn instance of ext-net interface is the network-id
        extNetworkId = new Uuid(vpnName);
    } catch (IllegalArgumentException e) {
        LOG.error("processExternalVpnInterface: VPN instance {} is not Uuid. Processing external vpn interface {}" + " on dpn {} failed", vpnName, interfaceName, dpId);
        return;
    }
    List<Uuid> routerIds = VpnUtil.getExternalNetworkRouterIds(dataBroker, extNetworkId);
    if (routerIds == null || routerIds.isEmpty()) {
        LOG.info("processExternalVpnInterface: No router is associated with {}." + " Bailing out of processing external vpn interface {} on dpn {} for vpn {}", extNetworkId.getValue(), interfaceName, dpId, vpnName);
        return;
    }
    LOG.info("processExternalVpnInterface: Router-ids {} associated with exernal vpn-interface {} on dpn {}" + " for vpn {}", routerIds, interfaceName, dpId, vpnName);
    for (Uuid routerId : routerIds) {
        String routerName = routerId.getValue();
        BigInteger primarySwitch = VpnUtil.getPrimarySwitchForRouter(dataBroker, routerName);
        if (Objects.equals(primarySwitch, dpId)) {
            Routers router = VpnUtil.getExternalRouter(dataBroker, routerName);
            if (router != null) {
                if (addOrRemove == NwConstants.ADD_FLOW) {
                    vpnManager.addArpResponderFlowsToExternalNetworkIps(routerName, VpnUtil.getIpsListFromExternalIps(router.getExternalIps()), router.getExtGwMacAddress(), dpId, interfaceName, lportTag, writeInvTxn);
                } else {
                    vpnManager.removeArpResponderFlowsToExternalNetworkIps(routerName, VpnUtil.getIpsListFromExternalIps(router.getExternalIps()), dpId, interfaceName, lportTag);
                }
            } else {
                LOG.error("processExternalVpnInterface: No external-router found for router-id {}. Bailing out of" + " processing external vpn-interface {} on dpn {} for vpn {}", routerName, interfaceName, dpId, vpnName);
            }
        }
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) BigInteger(java.math.BigInteger)

Aggregations

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)86 BigInteger (java.math.BigInteger)35 ArrayList (java.util.ArrayList)34 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)23 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)22 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)20 Routers (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers)20 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)19 ProviderTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)19 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)17 ExecutionException (java.util.concurrent.ExecutionException)16 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)14 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)12 ExternalIps (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps)12 IpPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.intext.ip.port.map.ip.port.mapping.intext.ip.protocol.type.IpPortMap)12 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)11 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)11 HashSet (java.util.HashSet)10 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)10 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)10