use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NodeConnectedHandler method copyHANodeConfigToChild.
/**
* Copy HA global node data to Child HA node of config data tree .
*
* @param srcNode Node which to be transformed
* @param childPath Path to which source node will be transformed
* @param tx Transaction
*/
private void copyHANodeConfigToChild(Node srcNode, InstanceIdentifier<Node> childPath, TypedReadWriteTransaction<Configuration> tx) {
if (srcNode == null) {
return;
}
HwvtepGlobalAugmentation src = srcNode.augmentation(HwvtepGlobalAugmentation.class);
if (src == null) {
return;
}
NodeBuilder nodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(childPath);
HwvtepGlobalAugmentationBuilder dstBuilder = new HwvtepGlobalAugmentationBuilder();
globalAugmentationMerger.mergeConfigData(dstBuilder, src, childPath);
globalNodeMerger.mergeConfigData(nodeBuilder, srcNode, childPath);
nodeBuilder.addAugmentation(dstBuilder.build());
Node dstNode = nodeBuilder.build();
tx.mergeParentStructurePut(childPath, dstNode);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NeutronvpnNatManager method handleExternalFixedIpsForRouter.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleExternalFixedIpsForRouter(Router update) {
Uuid routerId = update.getUuid();
InstanceIdentifier<Routers> routersIdentifier = NeutronvpnUtils.buildExtRoutersIdentifier(routerId);
try {
Optional<Routers> optionalRouters = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier);
LOG.trace("Updating External Fixed IPs Routers node {}", routerId.getValue());
if (optionalRouters.isPresent()) {
RoutersBuilder builder = new RoutersBuilder(optionalRouters.get());
List<ExternalIps> externalIps = new ArrayList<>();
for (ExternalFixedIps fixedIps : update.getExternalGatewayInfo().nonnullExternalFixedIps().values()) {
addExternalFixedIpToExternalIpsList(externalIps, fixedIps);
}
builder.setExternalIps(externalIps);
updateExternalSubnetsForRouter(routerId, update.getExternalGatewayInfo().getExternalNetworkId(), new ArrayList<ExternalFixedIps>(update.getExternalGatewayInfo().nonnullExternalFixedIps().values()));
Routers routerss = builder.build();
LOG.trace("Updating external fixed ips for router {} with value {}", routerId.getValue(), routerss);
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier, routerss);
LOG.trace("Added External Fixed IPs successfully for Routers to CONFIG Datastore");
}
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException ex) {
LOG.error("Updating extfixedips for {} in extrouters failed", routerId.getValue(), ex);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NeutronvpnNatManager method handleSubnetsForExternalRouter.
public void handleSubnetsForExternalRouter(Uuid routerId) {
InstanceIdentifier<Routers> routersIdentifier = NeutronvpnUtils.buildExtRoutersIdentifier(routerId);
try {
Optional<Routers> optionalRouters = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier);
LOG.trace("Updating Internal subnets for Routers node: {}", routerId.getValue());
RoutersBuilder builder = null;
if (optionalRouters.isPresent()) {
builder = new RoutersBuilder(optionalRouters.get());
} else {
LOG.debug("No Routers element found for router {}", routerId.getValue());
return;
}
List<Uuid> subList = neutronvpnUtils.getNeutronRouterSubnetIds(routerId);
builder.setSubnetIds(subList);
Routers routerss = builder.build();
// Add Routers object to the ExtRouters list
LOG.trace("Updating extrouters {}", routerss);
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier, routerss);
LOG.trace("Updated successfully Routers to CONFIG Datastore");
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException ex) {
LOG.error("Updation of internal subnets for extrouters failed for router {}", routerId.getValue(), ex);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NeutronvpnNatManager method handleSnatSettingChangeForRouter.
private void handleSnatSettingChangeForRouter(Router update) {
Uuid routerId = update.getUuid();
InstanceIdentifier<Routers> routersIdentifier = NeutronvpnUtils.buildExtRoutersIdentifier(routerId);
try {
Optional<Routers> optionalRouters = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier);
LOG.trace("Updating Internal subnets for Routers node: {}", routerId.getValue());
RoutersBuilder builder = null;
if (optionalRouters.isPresent()) {
builder = new RoutersBuilder(optionalRouters.get());
} else {
LOG.trace("No Routers element found for router name {}", routerId.getValue());
return;
}
builder.setEnableSnat(update.getExternalGatewayInfo().isEnableSnat());
Routers routerss = builder.build();
// Add Routers object to the ExtRouters list
LOG.trace("Updating extrouters for snat change {}", routerss);
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier, routerss);
LOG.trace("Updated successfully Routers to CONFIG Datastore");
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException ex) {
LOG.error("Updation of snat for extrouters failed for router {}", routerId.getValue(), ex);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class NeutronvpnNatManager method addExternalNetworkToRouter.
private void addExternalNetworkToRouter(Router update) {
Uuid routerId = update.getUuid();
Uuid extNetId = update.getExternalGatewayInfo().getExternalNetworkId();
Map<ExternalFixedIpsKey, ExternalFixedIps> keyExternalFixedIpsMap = update.getExternalGatewayInfo().nonnullExternalFixedIps();
try {
Network input = neutronvpnUtils.getNeutronNetwork(extNetId);
ProviderTypes providerNwType = NeutronvpnUtils.getProviderNetworkType(input);
if (providerNwType == null) {
LOG.error("Unable to get Network Provider Type for network {}", input.getUuid().getValue());
return;
}
// Add this router to the ExtRouters list
addExternalRouter(update);
// Update External Subnets for this router
updateExternalSubnetsForRouter(routerId, extNetId, new ArrayList<ExternalFixedIps>(keyExternalFixedIpsMap.values()));
// Create and add Networks object for this External Network to the ExternalNetworks list
InstanceIdentifier<Networks> netsIdentifier = InstanceIdentifier.builder(ExternalNetworks.class).child(Networks.class, new NetworksKey(extNetId)).build();
Optional<Networks> optionalNets = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, netsIdentifier);
if (!optionalNets.isPresent()) {
LOG.error("External Network {} not present in the NVPN datamodel", extNetId.getValue());
return;
}
NetworksBuilder builder = new NetworksBuilder(optionalNets.get());
List<Uuid> rtrList = (builder.getRouterIds() != null && !builder.getRouterIds().isEmpty()) ? new ArrayList<>(builder.getRouterIds()) : new ArrayList<>();
rtrList.add(routerId);
builder.setRouterIds(rtrList);
if (NeutronvpnUtils.isFlatOrVlanNetwork(input)) {
builder.setVpnid(extNetId);
}
Networks networkss = builder.build();
// Add Networks object to the ExternalNetworks list
LOG.trace("Updating externalnetworks {}", networkss);
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, netsIdentifier, networkss);
LOG.trace("Updated externalnetworks successfully to CONFIG Datastore");
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException ex) {
LOG.error("Creation of externalnetworks failed for {}", extNetId.getValue(), ex);
}
}
Aggregations