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);
}
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);
}
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;
});
}
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);
}
}
}
}
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);
}
}
Aggregations