use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.
the class NeutronvpnManager method addInterVpnRoutes.
/**
* Creates the corresponding static routes in the specified VPN. These static routes must be point to an
* InterVpnLink endpoint and the specified VPN must be the other end of the InterVpnLink. Otherwise the
* route will be ignored.
*
* @param vpnName the VPN identifier
* @param interVpnLinkRoutes The list of static routes
* @param nexthopsXinterVpnLinks A Map with the correspondence nextHop-InterVpnLink
*/
public void addInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes, HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
for (Routes route : interVpnLinkRoutes) {
String nexthop = String.valueOf(route.getNexthop().getValue());
String destination = String.valueOf(route.getDestination().getValue());
InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
AddStaticRouteInput rpcInput = new AddStaticRouteInputBuilder().setDestination(destination).setNexthop(nexthop).setVpnInstanceName(vpnName.getValue()).build();
Future<RpcResult<AddStaticRouteOutput>> labelOuputFtr = vpnRpcService.addStaticRoute(rpcInput);
RpcResult<AddStaticRouteOutput> rpcResult;
try {
rpcResult = labelOuputFtr.get();
if (rpcResult.isSuccessful()) {
LOG.debug("Label generated for destination {} is: {}", destination, rpcResult.getResult().getLabel());
} else {
LOG.error("RPC call to add a static Route to {} with nexthop {} returned with errors {}", destination, nexthop, rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error happened while invoking addStaticRoute RPC for nexthop {} with destination {} " + "for VPN {}", nexthop, destination, vpnName.getValue(), e);
}
} else {
// Any other case is a fault.
LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink", String.valueOf(route.getDestination().getValue()), nexthop);
continue;
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.
the class NeutronvpnManager method removeInterVpnRoutes.
/**
* Removes the corresponding static routes from the specified VPN. These static routes point to an
* InterVpnLink endpoint and the specified VPN must be the other end of the InterVpnLink.
*
* @param vpnName the VPN identifier
* @param interVpnLinkRoutes The list of static routes
* @param nexthopsXinterVpnLinks A Map with the correspondence nextHop-InterVpnLink
*/
public void removeInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes, HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
for (Routes route : interVpnLinkRoutes) {
String nexthop = String.valueOf(route.getNexthop().getValue());
String destination = String.valueOf(route.getDestination().getValue());
InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
RemoveStaticRouteInput rpcInput = new RemoveStaticRouteInputBuilder().setDestination(destination).setNexthop(nexthop).setVpnInstanceName(vpnName.getValue()).build();
ListenableFutures.addErrorLogging(JdkFutureAdapters.listenInPoolThread(vpnRpcService.removeStaticRoute(rpcInput)), LOG, "Remove VPN routes");
} else {
// Any other case is a fault.
LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink", String.valueOf(route.getDestination().getValue()), nexthop);
continue;
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.
the class NeutronBgpvpnChangeListener method update.
@Override
protected void update(InstanceIdentifier<Bgpvpn> identifier, Bgpvpn original, Bgpvpn update) {
LOG.trace("Update Bgpvpn : key: {}, value={}", identifier, update);
Uuid vpnId = update.getUuid();
if (isBgpvpnTypeL3(update.getType())) {
try {
handleVpnInstanceUpdate(original.getUuid().getValue(), original.getRouteDistinguishers(), update.getRouteDistinguishers());
} catch (UnsupportedOperationException e) {
LOG.error("Error while processing Update Bgpvpn.", e);
return;
}
List<Uuid> oldNetworks = original.getNetworks();
List<Uuid> newNetworks = update.getNetworks();
handleNetworksUpdate(vpnId, oldNetworks, newNetworks);
List<Uuid> oldRouters = original.getRouters();
List<Uuid> newRouters = update.getRouters();
handleRoutersUpdate(vpnId, oldRouters, newRouters);
} else {
LOG.warn("BGPVPN type for VPN {} is not L3", vpnId.getValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.
the class NeutronFloatingToFixedIpMappingChangeListener method add.
@Override
protected void add(InstanceIdentifier<Floatingip> identifier, Floatingip input) {
LOG.trace("Neutron Floating IP created: key: {}, value={}", identifier, input);
IpAddress fixedIp = input.getFixedIpAddress();
String floatingIp = input.getFloatingIpAddress().getIpv4Address().getValue();
if (fixedIp != null) {
addToFloatingIpInfo(input.getRouterId().getValue(), input.getFloatingNetworkId(), input.getPortId().getValue(), fixedIp.getIpv4Address().getValue(), floatingIp, input.getUuid());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.
the class NeutronFloatingToFixedIpMappingChangeListener method remove.
@Override
protected void remove(InstanceIdentifier<Floatingip> identifier, Floatingip input) {
LOG.trace("Neutron Floating IP deleted : key: {}, value={}", identifier, input);
IpAddress fixedIp = input.getFixedIpAddress();
if (fixedIp != null) {
// update FloatingIpPortInfo to set isFloatingIpDeleted as true to enable deletion of FloatingIpPortInfo
// map once it is used for processing in the NAT removal path
updateFloatingIpPortInfo(input.getUuid(), input.getPortId());
clearFromFloatingIpInfo(input.getRouterId().getValue(), input.getPortId().getValue(), fixedIp.getIpv4Address().getValue());
} else {
// delete FloatingIpPortInfo mapping since floating IP is deleted and no fixed IP is associated to it
removeFromFloatingIpPortInfo(input.getUuid());
}
}
Aggregations