use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpn in project netvirt by opendaylight.
the class NeutronvpnManager method checkAndPublishRouterAssociatedtoVpnNotification.
private void checkAndPublishRouterAssociatedtoVpnNotification(Uuid routerId, Uuid vpnId) throws InterruptedException {
RouterAssociatedToVpn routerAssociatedToVpn = new RouterAssociatedToVpnBuilder().setRouterId(routerId).setVpnId(vpnId).build();
LOG.info("publishing notification upon association of router to VPN");
notificationPublishService.putNotification(routerAssociatedToVpn);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpn in project netvirt by opendaylight.
the class RouterToVpnListener method onRouterAssociatedToVpn.
/**
* router association to vpn.
*/
@Override
public void onRouterAssociatedToVpn(RouterAssociatedToVpn notification) {
String routerName = notification.getRouterId().getValue();
String vpnName = notification.getVpnId().getValue();
WriteTransaction writeFlowInvTx = dataBroker.newWriteOnlyTransaction();
// check router is associated to external network
String extNetwork = NatUtil.getAssociatedExternalNetwork(dataBroker, routerName);
if (extNetwork != null) {
LOG.debug("onRouterAssociatedToVpn : Router {} is associated with ext nw {}", routerName, extNetwork);
handleDNATConfigurationForRouterAssociation(routerName, vpnName, extNetwork);
Uuid extNetworkUuid = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
if (extNetworkUuid == null) {
LOG.error("onRouterAssociatedToVpn : Unable to retrieve external network Uuid for router {}", routerName);
return;
}
ProviderTypes extNwProvType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerName, extNetworkUuid);
if (extNwProvType == null) {
LOG.error("onRouterAssociatedToVpn : External Network Provider Type missing");
return;
}
long routerId = NatUtil.getVpnId(dataBroker, routerName);
externalRoutersListener.changeLocalVpnIdToBgpVpnId(routerName, routerId, vpnName, writeFlowInvTx, extNwProvType);
} else {
LOG.debug("onRouterAssociatedToVpn : Ignoring the Router {} association with VPN {} " + "since it is not external router", routerName, vpnName);
}
NatUtil.waitForTransactionToComplete(writeFlowInvTx);
}
Aggregations