Search in sources :

Example 1 with RouterAssociatedToVpn

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);
}
Also used : RouterAssociatedToVpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpn) RouterAssociatedToVpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpnBuilder)

Example 2 with 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);
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) ProviderTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)

Aggregations

WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 ProviderTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)1 RouterAssociatedToVpn (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpn)1 RouterAssociatedToVpnBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.RouterAssociatedToVpnBuilder)1