Search in sources :

Example 1 with RouterInterfaceBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.router.interfaces.RouterInterfaceBuilder 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);
}
Also used : RouterInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface) Adjacency(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency) RouterInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterfaceBuilder)

Aggregations

RouterInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface)1 RouterInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterfaceBuilder)1 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)1