Search in sources :

Example 1 with Mac

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac in project netvirt by opendaylight.

the class ElanInterfaceManager method installDpnMacsInL2gwDevice.

/**
 * Installs dpn macs in external device. first it checks if the physical
 * locator towards this dpn tep is present or not if the physical locator is
 * present go ahead and add the ucast macs otherwise update the mcast mac
 * entry to include this dpn tep ip and schedule the job to put ucast macs
 * once the physical locator is programmed in device
 *
 * @param elanName
 *            the elan name
 * @param lstElanInterfaceNames
 *            the lst Elan interface names
 * @param dpnId
 *            the dpn id
 * @param externalNodeId
 *            the external node id
 */
private void installDpnMacsInL2gwDevice(String elanName, Set<String> lstElanInterfaceNames, BigInteger dpnId, NodeId externalNodeId) {
    L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, externalNodeId.getValue());
    if (elanL2GwDevice == null) {
        LOG.debug("L2 gw device not found in elan cache for device name {}", externalNodeId);
        return;
    }
    IpAddress dpnTepIp = elanItmUtils.getSourceDpnTepIp(dpnId, externalNodeId);
    if (dpnTepIp == null) {
        LOG.warn("Could not install dpn macs in l2gw device , dpnTepIp not found dpn : {} , nodeid : {}", dpnId, externalNodeId);
        return;
    }
    String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(elanName);
    RemoteMcastMacs remoteMcastMac = elanL2GatewayUtils.readRemoteMcastMac(externalNodeId, logicalSwitchName, LogicalDatastoreType.OPERATIONAL);
    boolean phyLocAlreadyExists = ElanL2GatewayUtils.checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(externalNodeId, remoteMcastMac, dpnTepIp);
    LOG.debug("phyLocAlreadyExists = {} for locator [{}] in remote mcast entry for elan [{}], nodeId [{}]", phyLocAlreadyExists, String.valueOf(dpnTepIp.getValue()), elanName, externalNodeId.getValue());
    List<PhysAddress> staticMacs = elanL2GatewayUtils.getElanDpnMacsFromInterfaces(lstElanInterfaceNames);
    if (phyLocAlreadyExists) {
        elanL2GatewayUtils.scheduleAddDpnMacsInExtDevice(elanName, dpnId, staticMacs, elanL2GwDevice);
        return;
    }
    elanL2GatewayMulticastUtils.scheduleMcastMacUpdateJob(elanName, elanL2GwDevice);
    elanL2GatewayUtils.scheduleAddDpnMacsInExtDevice(elanName, dpnId, staticMacs, elanL2GwDevice);
}
Also used : RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 2 with Mac

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac in project netvirt by opendaylight.

the class ElanInterfaceManager method createElanStateList.

private void createElanStateList(String elanInstanceName, String interfaceName, WriteTransaction tx) {
    InstanceIdentifier<Elan> elanInstance = ElanUtils.getElanInstanceOperationalDataPath(elanInstanceName);
    Optional<Elan> elanInterfaceLists = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL, elanInstance);
    // Static-Mac Entries..
    if (elanInterfaceLists.isPresent()) {
        List<String> interfaceLists = elanInterfaceLists.get().getElanInterfaces();
        if (interfaceLists == null) {
            interfaceLists = new ArrayList<>();
        }
        interfaceLists.add(interfaceName);
        Elan elanState = new ElanBuilder().setName(elanInstanceName).setElanInterfaces(interfaceLists).setKey(new ElanKey(elanInstanceName)).build();
        tx.put(LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInstanceOperationalDataPath(elanInstanceName), elanState, WriteTransaction.CREATE_MISSING_PARENTS);
    }
}
Also used : Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) ElanKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanKey) ElanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder)

Example 3 with Mac

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac in project netvirt by opendaylight.

the class NetworkL2gwDeviceInfoCli method printRemoteUcastMacs.

@SuppressWarnings("checkstyle:HiddenField")
void printRemoteUcastMacs(Node hwvtepNode, String elanName) {
    session.getConsole().println("RemoteUCast macs :");
    session.getConsole().println(HEADINGUCAST);
    if (hwvtepNode == null || hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class) == null) {
        return;
    }
    List<RemoteUcastMacs> remoteUcastMacs = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class).getRemoteUcastMacs();
    if (remoteUcastMacs == null || remoteUcastMacs.isEmpty()) {
        return;
    }
    for (RemoteUcastMacs remoteMac : remoteUcastMacs) {
        String lsFromRemoteMac = getLogicalSwitchValue(remoteMac.getLogicalSwitchRef());
        if (elanName.equals(lsFromRemoteMac)) {
            String mac = remoteMac.getMacEntryKey().getValue();
            String locator = getLocatorValue(remoteMac.getLocatorRef());
            session.getConsole().println(mac + GAP + locator);
        }
    }
}
Also used : RemoteUcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)

Example 4 with Mac

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac in project netvirt by opendaylight.

the class NetworkL2gwDeviceInfoCli method printLocalUcastMacs.

@SuppressWarnings("checkstyle:HiddenField")
void printLocalUcastMacs(Node hwvtepNode, String elanName) {
    session.getConsole().println("LocalUCast macs :");
    session.getConsole().println(HEADINGUCAST);
    if (hwvtepNode == null || hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class) == null) {
        return;
    }
    List<LocalUcastMacs> localUcastMacs = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class).getLocalUcastMacs();
    if (localUcastMacs == null || localUcastMacs.isEmpty()) {
        return;
    }
    for (LocalUcastMacs localMac : localUcastMacs) {
        String lsFromLocalMac = getLogicalSwitchValue(localMac.getLogicalSwitchRef());
        if (elanName.equals(lsFromLocalMac)) {
            String mac = localMac.getMacEntryKey().getValue();
            String locator = getLocatorValue(localMac.getLocatorRef());
            session.getConsole().println(mac + GAP + locator);
        }
    }
}
Also used : LocalUcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation)

Example 5 with Mac

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac in project netvirt by opendaylight.

the class NetworkL2gwDeviceInfoCli method printRemoteMcastMacs.

@SuppressWarnings("checkstyle:HiddenField")
void printRemoteMcastMacs(Node hwvtepNode, String elanName) {
    session.getConsole().println("RemoteMCast macs :");
    session.getConsole().println(HEADINGMCAST);
    if (hwvtepNode == null || hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class) == null) {
        return;
    }
    List<RemoteMcastMacs> remoteMcastMacs = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class).getRemoteMcastMacs();
    if (remoteMcastMacs == null || remoteMcastMacs.isEmpty()) {
        return;
    }
    for (RemoteMcastMacs remoteMac : remoteMcastMacs) {
        String lsFromremoteMac = getLogicalSwitchValue(remoteMac.getLogicalSwitchRef());
        if (elanName.equals(lsFromremoteMac)) {
            String mac = remoteMac.getMacEntryKey().getValue();
            List<String> locatorsets = new ArrayList<>();
            for (LocatorSet locatorSet : remoteMac.getLocatorSet()) {
                locatorsets.add(getLocatorValue(locatorSet.getLocatorRef()));
            }
            session.getConsole().println(mac + GAP + locatorsets.toString());
        }
    }
}
Also used : LocatorSet(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet) RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) HwvtepGlobalAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)57 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)50 BigInteger (java.math.BigInteger)36 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)34 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)21 Test (org.junit.Test)20 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)18 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)18 Collections (java.util.Collections)17 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)17 List (java.util.List)16 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 ExecutionException (java.util.concurrent.ExecutionException)15 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)15 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)15 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)15 Inject (javax.inject.Inject)14