Search in sources :

Example 26 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 WavebandSwitchingLabelParser method serializeLabel.

@Override
public final void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject instanceof WavebandSwitchingLabelCase, "Unknown Label Subobject instance. Passed {}. Needed WavebandSwitchingLabelCase.", subobject.getClass());
    final WavebandSwitchingLabel obj = ((WavebandSwitchingLabelCase) subobject).getWavebandSwitchingLabel();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    Preconditions.checkArgument(obj.getWavebandId() != null, "WavebandId is mandatory.");
    writeUnsignedInt(obj.getWavebandId(), body);
    Preconditions.checkArgument(obj.getStartLabel() != null, "StartLabel is mandatory.");
    writeUnsignedInt(obj.getStartLabel(), body);
    Preconditions.checkArgument(obj.getEndLabel() != null, "EndLabel is mandatory.");
    writeUnsignedInt(obj.getEndLabel(), body);
    LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Also used : WavebandSwitchingLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase) ByteBuf(io.netty.buffer.ByteBuf) WavebandSwitchingLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.waveband.switching.label._case.WavebandSwitchingLabel)

Example 27 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 WavebandSwitchingLabelParser method serializeLabel.

@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject instanceof WavebandSwitchingLabelCase, "Unknown Label Subobject instance. Passed {}. Needed WavebandSwitchingLabelCase.", subobject.getClass());
    final WavebandSwitchingLabel obj = ((WavebandSwitchingLabelCase) subobject).getWavebandSwitchingLabel();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    Preconditions.checkArgument(obj.getWavebandId() != null, "WavebandId is mandatory.");
    writeUnsignedInt(obj.getWavebandId(), body);
    Preconditions.checkArgument(obj.getStartLabel() != null, "StartLabel is mandatory.");
    writeUnsignedInt(obj.getStartLabel(), body);
    Preconditions.checkArgument(obj.getEndLabel() != null, "EndLabel is mandatory.");
    writeUnsignedInt(obj.getEndLabel(), body);
    LabelUtil.formatLabel(CTYPE, unidirectional, global, body, buffer);
}
Also used : WavebandSwitchingLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase) ByteBuf(io.netty.buffer.ByteBuf) WavebandSwitchingLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.waveband.switching.label._case.WavebandSwitchingLabel)

Example 28 with Global

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

the class HwvtepPhysicalSwitchListener method added.

@Override
protected void added(InstanceIdentifier<PhysicalSwitchAugmentation> identifier, final PhysicalSwitchAugmentation phySwitchAdded) {
    String globalNodeId = getManagedByNodeId(identifier);
    final InstanceIdentifier<Node> globalNodeIid = getManagedByNodeIid(identifier);
    NodeId nodeId = getNodeId(identifier);
    if (TUNNEL_IP_NOT_AVAILABLE.test(phySwitchAdded)) {
        LOG.error("Could not find the /tunnel ips for node {}", nodeId.getValue());
        return;
    }
    final String psName = getPsName(identifier);
    LOG.trace("Received physical switch {} added event received for node {}", psName, nodeId.getValue());
    haOpClusteredListener.runAfterNodeIsConnected(globalNodeIid, (node) -> {
        LOG.trace("Running job for node {} ", globalNodeIid);
        if (!node.isPresent()) {
            LOG.error("Global node is absent {}", globalNodeId);
            return;
        }
        HAOpClusteredListener.addToCacheIfHAChildNode(globalNodeIid, node.get());
        if (hwvtepHACache.isHAEnabledDevice(globalNodeIid)) {
            LOG.trace("Ha enabled device {}", globalNodeIid);
            return;
        }
        LOG.trace("Updating cache for node {}", globalNodeIid);
        L2GatewayDevice l2GwDevice = l2GatewayCache.get(psName);
        if (childConnectedAfterParent.test(l2GwDevice, globalNodeIid)) {
            LOG.trace("Device {} {} is already Connected by {}", psName, globalNodeId, l2GwDevice.getHwvtepNodeId());
            return;
        }
        InstanceIdentifier<Node> existingIid = globalNodeIid;
        if (l2GwDevice != null && l2GwDevice.getHwvtepNodeId() != null) {
            existingIid = HwvtepHAUtil.convertToInstanceIdentifier(l2GwDevice.getHwvtepNodeId());
        }
        if (parentConnectedAfterChild.test(l2GwDevice, globalNodeIid) && alreadyHasL2Gwids.test(l2GwDevice)) {
            LOG.error("Child node {} having l2gw configured became ha node " + " removing the l2device {} from all elan cache and provision parent node {}", existingIid, psName, globalNodeIid);
            ElanL2GwCacheUtils.removeL2GatewayDeviceFromAllElanCache(l2GwDevice.getHwvtepNodeId());
        }
        l2GwDevice = l2GatewayCache.addOrGet(psName);
        l2GwDevice.setConnected(true);
        l2GwDevice.setHwvtepNodeId(globalNodeId);
        List<TunnelIps> tunnelIps = phySwitchAdded.getTunnelIps();
        if (tunnelIps != null) {
            for (TunnelIps tunnelIp : tunnelIps) {
                IpAddress tunnelIpAddr = tunnelIp.getTunnelIpsKey();
                l2GwDevice.addTunnelIp(tunnelIpAddr);
            }
        }
        handleAdd(l2GwDevice);
        elanClusterUtils.runOnlyInOwnerNode("Update config tunnels IP ", () -> {
            try {
                updateConfigTunnelIp(identifier, phySwitchAdded);
            } catch (ReadFailedException e) {
                LOG.error("Failed to update tunnel ips {}", identifier);
            }
        });
        return;
    });
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) TunnelIps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 29 with Global

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

the class HwvtepNodeBaseListener method processDisconnectedNodes.

private void processDisconnectedNodes(Collection<DataTreeModification<Node>> changes, ReadWriteTransaction tx) throws InterruptedException, ExecutionException, ReadFailedException {
    for (DataTreeModification<Node> change : changes) {
        final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
        final DataObjectModification<Node> mod = change.getRootNode();
        Node deleted = HwvtepHAUtil.getRemoved(mod);
        String nodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
        if (deleted != null) {
            if (!nodeId.contains(HwvtepHAUtil.PHYSICALSWITCH)) {
                LOG.trace("Handle global node delete {}", deleted.getNodeId().getValue());
                onGlobalNodeDelete(key, deleted, tx);
            } else {
                LOG.trace("Handle ps node node delete {}", deleted.getNodeId().getValue());
                onPsNodeDelete(key, deleted, tx);
            }
        }
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 30 with Global

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

the class NodeConnectedHandler method deleteChildPSConfigIfHAPSConfigIsMissing.

private void deleteChildPSConfigIfHAPSConfigIsMissing(Optional<Node> haPSCfg, Node childNode, ReadWriteTransaction tx) throws ReadFailedException {
    if (haPSCfg.isPresent()) {
        return;
    }
    LOG.info("HA ps node not present cleanup child {}", childNode);
    HwvtepGlobalAugmentation augmentation = childNode.getAugmentation(HwvtepGlobalAugmentation.class);
    if (augmentation != null) {
        List<Switches> switches = augmentation.getSwitches();
        if (switches != null) {
            for (Switches ps : switches) {
                HwvtepHAUtil.deleteNodeIfPresent(tx, CONFIGURATION, ps.getSwitchRef().getValue());
            }
        }
    } else {
        LOG.info("Global augumentation not present for connected ha child node {}", childNode);
    }
}
Also used : Switches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)

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