use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterface in project netvirt by opendaylight.
the class VpnInterfaceManager method createFibEntryForRouterInterface.
protected void createFibEntryForRouterInterface(String primaryRd, VpnInterface vpnInterface, String interfaceName, WriteTransaction writeConfigTxn, String vpnName) {
if (vpnInterface == null) {
return;
}
List<Adjacency> adjs = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, interfaceName);
if (adjs == null) {
LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as adjacencies for" + " this vpn interface could not be obtained. vpn {}", interfaceName, vpnName);
return;
}
for (Adjacency adj : adjs) {
if (adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
String primaryInterfaceIp = adj.getIpAddress();
String macAddress = adj.getMacAddress();
String prefix = VpnUtil.getIpPrefix(primaryInterfaceIp);
long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME, VpnUtil.getNextHopLabelKey(primaryRd, prefix));
RouterInterface routerInt = new RouterInterfaceBuilder().setUuid(vpnName).setIpAddress(primaryInterfaceIp).setMacAddress(macAddress).build();
fibManager.addFibEntryForRouterInterface(primaryRd, prefix, routerInt, label, writeConfigTxn);
LOG.info("createFibEntryForRouterInterface: Router interface {} for vpn {} rd {} prefix {} label {}" + " macAddress {} processed successfully;", interfaceName, vpnName, primaryRd, prefix, label, macAddress);
return;
}
}
LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as primary" + " adjacency for this vpn interface could not be obtained. rd {} vpnName {}", interfaceName, primaryRd, vpnName);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterface in project netvirt by opendaylight.
the class VpnInterfaceManager method removeFromNeutronRouterDpnsMap.
protected void removeFromNeutronRouterDpnsMap(String routerName, String vpnInterfaceName, WriteTransaction writeOperTxn) {
BigInteger dpId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
if (dpId.equals(BigInteger.ZERO)) {
LOG.error("removeFromNeutronRouterDpnsMap: Could not retrieve dp id for interface {} to handle router {}" + " dissociation model", vpnInterfaceName, routerName);
return;
}
InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
if (optionalRouterDpnList.isPresent()) {
List<RouterInterfaces> routerInterfaces = optionalRouterDpnList.get().getRouterInterfaces();
RouterInterfaces routerInterface = new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(vpnInterfaceName).build();
if (routerInterfaces != null && routerInterfaces.remove(routerInterface)) {
if (routerInterfaces.isEmpty()) {
if (writeOperTxn != null) {
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
} else {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
}
} else {
if (writeOperTxn != null) {
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)));
} else {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)));
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterface in project netvirt by opendaylight.
the class NatUtil method removeFromNeutronRouterDpnsMap.
public static void removeFromNeutronRouterDpnsMap(DataBroker broker, String routerName, String vpnInterfaceName, OdlInterfaceRpcService ifaceMgrRpcService, WriteTransaction writeOperTxn) {
BigInteger dpId = getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
if (dpId.equals(BigInteger.ZERO)) {
LOG.debug("removeFromNeutronRouterDpnsMap : Could not retrieve dp id for interface {} to handle router {}" + " dissociation model", vpnInterfaceName, routerName);
return;
}
InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
Optional<DpnVpninterfacesList> optionalRouterDpnList = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
if (optionalRouterDpnList.isPresent()) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfaces> routerInterfaces = optionalRouterDpnList.get().getRouterInterfaces();
org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfaces routerInterface = new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(vpnInterfaceName).build();
if (routerInterfaces != null && routerInterfaces.remove(routerInterface)) {
if (routerInterfaces.isEmpty()) {
if (writeOperTxn != null) {
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
} else {
MDSALUtil.syncDelete(broker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
}
} else {
if (writeOperTxn != null) {
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)));
} else {
MDSALUtil.syncDelete(broker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)));
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterface in project netvirt by opendaylight.
the class RouterInterfaceVrfEntryHandler method createFlows.
@Override
public void createFlows(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
installRouterFibEntries(vrfEntry, rd, NwConstants.ADD_FLOW, routerInt);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterface in project netvirt by opendaylight.
the class VrfEntryListener method removeFibEntries.
// This method is temporary. Eventually Factory design pattern will be used to get
// right VrfEntryhandle and invoke its methods.
private void removeFibEntries(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
if (VrfEntry.EncapType.Vxlan.equals(vrfEntry.getEncapType())) {
LOG.info("EVPN flows to be deleted");
EvpnVrfEntryHandler evpnVrfEntryHandler = new EvpnVrfEntryHandler(dataBroker, this, bgpRouteVrfEntryHandler, nextHopManager, jobCoordinator, elanManager, fibUtil);
evpnVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
closeables.add(evpnVrfEntryHandler);
return;
}
RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
if (routerInt != null) {
// ping responder for router interfaces
routerInterfaceVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
return;
}
if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
deleteFibEntries(identifier, vrfEntry);
return;
}
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
bgpRouteVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
return;
}
}
Aggregations