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);
}
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);
}
}
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);
}
}
}
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);
}
}
}
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());
}
}
}
Aggregations