Search in sources :

Example 11 with Global

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global in project bgpcep by opendaylight.

the class GeneralizedLabelParser method serializeLabel.

@Override
public final void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject instanceof GeneralizedLabelCase, "Unknown Label Subobject instance. Passed {}. Needed GeneralizedLabelCase.", subobject.getClass());
    final GeneralizedLabel gl = ((GeneralizedLabelCase) subobject).getGeneralizedLabel();
    Preconditions.checkArgument(gl != null, "GeneralizedLabel is mandatory.");
    final ByteBuf body = Unpooled.wrappedBuffer(gl.getGeneralizedLabel());
    LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Also used : GeneralizedLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase) GeneralizedLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabel) ByteBuf(io.netty.buffer.ByteBuf)

Example 12 with Global

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global in project bgpcep by opendaylight.

the class Type1LabelParser method serializeLabel.

@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject instanceof Type1LabelCase, "Unknown Label Subobject instance. Passed {}. Needed Type1LabelCase.", subobject.getClass());
    final ByteBuf body = Unpooled.buffer(LABEL_LENGTH);
    final Type1Label type1Label = ((Type1LabelCase) subobject).getType1Label();
    Preconditions.checkArgument(type1Label != null, "Type1Label is mandatory.");
    writeUnsignedInt(type1Label.getType1Label(), body);
    LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Also used : Type1Label(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.type1.label._case.Type1Label) Type1LabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase) ByteBuf(io.netty.buffer.ByteBuf)

Example 13 with Global

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global in project bgpcep by opendaylight.

the class RibImpl method createRib.

private RIBImpl createRib(final Global global, final String bgpInstanceName, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
    this.afiSafi = getAfiSafiWithDefault(global.getAfiSafis(), true);
    final Config globalConfig = global.getConfig();
    this.asNumber = globalConfig.getAs();
    this.routerId = globalConfig.getRouterId();
    this.clusterId = getGlobalClusterIdentifier(globalConfig);
    final BGPPeerTrackerImpl peerTracker = new BGPPeerTrackerImpl();
    final Map<TablesKey, PathSelectionMode> pathSelectionModes = OpenConfigMappingUtil.toPathSelectionMode(this.afiSafi, tableTypeRegistry, peerTracker).entrySet().stream().collect(Collectors.toMap(entry -> new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
    final BGPRibRoutingPolicy ribPolicy = this.policyProvider.buildBGPRibPolicy(this.asNumber.getValue(), this.routerId, this.clusterId, RoutingPolicyUtil.getApplyPolicy(global.getApplyPolicy()));
    final CodecsRegistryImpl codecsRegistry = CodecsRegistryImpl.create(codecTreeFactory, this.extensions.getClassLoadingStrategy());
    return new RIBImpl(new RibId(bgpInstanceName), this.asNumber, new BgpId(this.routerId), this.extensions, this.dispatcher, codecsRegistry, this.domBroker, this.dataBroker, ribPolicy, peerTracker, toTableTypes(this.afiSafi, tableTypeRegistry), pathSelectionModes);
}
Also used : OpenConfigMappingUtil.getGlobalClusterIdentifier(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getGlobalClusterIdentifier) LoggerFactory(org.slf4j.LoggerFactory) ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration) BGPDispatcher(org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher) Rib(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib) TransactionChainListener(org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener) Map(java.util.Map) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) RIBImpl(org.opendaylight.protocol.bgp.rib.impl.RIBImpl) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) OpenConfigMappingUtil.toTableTypes(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes) BindingTransactionChain(org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain) DOMTransactionChain(org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) Set(java.util.Set) Collectors(java.util.stream.Collectors) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) List(java.util.List) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) DOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker) BGPRibRoutingPolicyFactory(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.BGPRibRoutingPolicyFactory) DOMSchemaService(org.opendaylight.mdsal.dom.api.DOMSchemaService) SchemaContextListener(org.opendaylight.yangtools.yang.model.api.SchemaContextListener) RIB(org.opendaylight.protocol.bgp.rib.impl.spi.RIB) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config) BGPRibRoutingPolicy(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy) RIBSupportContextRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry) CodecsRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.CodecsRegistry) BGPPeerTracker(org.opendaylight.protocol.bgp.rib.spi.BGPPeerTracker) ServiceRegistration(org.osgi.framework.ServiceRegistration) Global(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global) Logger(org.slf4j.Logger) BGPRibState(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState) RibKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) BindingCodecTreeFactory(org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory) BGPPeerTrackerImpl(org.opendaylight.protocol.bgp.rib.impl.BGPPeerTrackerImpl) Futures(com.google.common.util.concurrent.Futures) BGPRibStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer) BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) OpenConfigMappingUtil.getAfiSafiWithDefault(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getAfiSafiWithDefault) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) BGPTableTypeRegistryConsumer(org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer) Preconditions(com.google.common.base.Preconditions) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier) CodecsRegistryImpl(org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl) RIBExtensionConsumerContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext) BGPRibRoutingPolicy(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) CodecsRegistryImpl(org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config) BGPPeerTrackerImpl(org.opendaylight.protocol.bgp.rib.impl.BGPPeerTrackerImpl) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) Map(java.util.Map) RIBImpl(org.opendaylight.protocol.bgp.rib.impl.RIBImpl)

Example 14 with Global

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global in project bgpcep by opendaylight.

the class BGPClusterSingletonService method onGlobalChanged.

synchronized void onGlobalChanged(final DataObjectModification<Global> dataObjectModification) {
    switch(dataObjectModification.getModificationType()) {
        case DELETE:
            LOG.debug("Removing RIB instance: {}", this.bgpIid);
            if (this.ribImpl != null) {
                LOG.debug("RIB instance removed {}", this.ribImpl);
                closeAllBindedPeers();
                closeRibService();
            }
            break;
        case SUBTREE_MODIFIED:
        case WRITE:
            final Global global = dataObjectModification.getDataAfter();
            if (this.ribImpl == null) {
                onGlobalCreated(global);
            } else if (!this.ribImpl.isGlobalEqual(global)) {
                onGlobalUpdated(global);
            }
            break;
        default:
            break;
    }
}
Also used : Global(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global)

Example 15 with Global

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global in project bgpcep by opendaylight.

the class GeneralizedLabelParser method serializeLabel.

@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject instanceof GeneralizedLabelCase, "Unknown Label Subobject instance. Passed {}. Needed GeneralizedLabelCase.", subobject.getClass());
    final GeneralizedLabel gl = ((GeneralizedLabelCase) subobject).getGeneralizedLabel();
    Preconditions.checkArgument(gl != null, "GeneralizedLabel is mandatory.");
    final ByteBuf body = Unpooled.wrappedBuffer(gl.getGeneralizedLabel());
    LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Also used : GeneralizedLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase) GeneralizedLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabel) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)9 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)9 HwvtepGlobalAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)6 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 Global (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global)4 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)4 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)4 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 HwvtepGlobalAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder)3 Managers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Managers)3 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)3 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)3 Optional (com.google.common.base.Optional)2 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)2 Neighbors (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors)2