use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.RouterId in project netvirt by opendaylight.
the class VpnManagerImpl method addExtraRoute.
@Override
public void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID, int label, RouteOrigin origin) {
LOG.info("Adding extra route with destination {}, nextHop {}, label{} and origin {}", destination, nextHop, label, origin);
VpnInstanceOpDataEntry vpnOpEntry = VpnUtil.getVpnInstanceOpData(dataBroker, rd);
Boolean isVxlan = VpnUtil.isL3VpnOverVxLan(vpnOpEntry.getL3vni());
VrfEntry.EncapType encapType = VpnUtil.getEncapType(isVxlan);
addExtraRoute(vpnName, destination, nextHop, rd, routerID, vpnOpEntry.getL3vni(), origin, /*intfName*/
null, null, /*Adjacency*/
encapType, null);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.RouterId in project netvirt by opendaylight.
the class NeutronvpnNatManager method removeRouterFromExternalSubnets.
private void removeRouterFromExternalSubnets(Uuid routerId, Uuid externalNetworkId, List<ExternalFixedIps> externalFixedIps) {
LOG.debug("Removing routerID {} from external subnets of external network{}", routerId, externalNetworkId);
List<Subnets> fixedIpsSubnets = getSubnets(getExternalSubnetsUuidsSetForFixedIps(externalFixedIps));
for (Subnets subnets : fixedIpsSubnets) {
Uuid subnetId = subnets.getId();
List<Uuid> routerIds = subnets.getRouterIds();
if (routerIds != null) {
if (subnets.getExternalNetworkId() != null && subnets.getExternalNetworkId().equals(externalNetworkId) && routerIds.contains(routerId)) {
routerIds.remove(routerId);
LOG.debug("Will remove routerIDs {} from external subnet {} router ID {}", routerIds, subnetId, routerId);
addExternalSubnet(externalNetworkId, subnetId, routerIds);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.RouterId in project netvirt by opendaylight.
the class NeutronvpnNatManager method addRouterIdToExternalSubnet.
public void addRouterIdToExternalSubnet(Uuid networkId, Uuid subnetId, Uuid routerId) {
Optional<Subnets> optionalExternalSubnets = neutronvpnUtils.getOptionalExternalSubnets(subnetId);
if (optionalExternalSubnets.isPresent()) {
Subnets subnets = optionalExternalSubnets.get();
List<Uuid> routerIds;
if (subnets.getRouterIds() != null) {
routerIds = subnets.getRouterIds();
} else {
routerIds = new ArrayList<>();
}
if (subnets.getExternalNetworkId() != null && subnets.getExternalNetworkId().equals(networkId) && !routerIds.contains(routerId)) {
LOG.debug("Will add routerID {} for external subnet {}.", routerId, subnetId);
routerIds.add(routerId);
updateExternalSubnet(networkId, subnetId, routerIds);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.RouterId 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().getExternalFixedIps()) {
addExternalFixedIpToExternalIpsList(externalIps, fixedIps);
}
builder.setExternalIps(externalIps);
updateExternalSubnetsForRouter(routerId, update.getExternalGatewayInfo().getExternalNetworkId(), update.getExternalGatewayInfo().getExternalFixedIps());
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 | ReadFailedException ex) {
LOG.error("Updating extfixedips for {} in extrouters failed", routerId.getValue(), ex);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.RouterId in project netvirt by opendaylight.
the class NeutronvpnNatManager method removeExternalRouter.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeExternalRouter(Router update) {
Uuid routerId = update.getUuid();
InstanceIdentifier<Routers> routersIdentifier = NeutronvpnUtils.buildExtRoutersIdentifier(routerId);
try {
Optional<Routers> optionalRouters = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier);
LOG.trace(" Removing Routers node {}", routerId.getValue());
if (optionalRouters.isPresent()) {
RoutersBuilder builder = new RoutersBuilder(optionalRouters.get());
builder.setExternalIps(null);
builder.setSubnetIds(null);
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIdentifier);
LOG.trace("Removed router {} from extrouters", routerId.getValue());
}
} catch (TransactionCommitFailedException | ReadFailedException ex) {
LOG.error("Removing extrouter {} from extrouters failed", routerId.getValue(), ex);
}
}
Aggregations