use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs 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.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs in project netvirt by opendaylight.
the class LocalUcastMacListener method getChildMod.
@Override
protected Map<InstanceIdentifier<LocalUcastMacs>, DataObjectModification<LocalUcastMacs>> getChildMod(final InstanceIdentifier<Node> parentIid, final DataObjectModification<Node> mod) {
Map<InstanceIdentifier<LocalUcastMacs>, DataObjectModification<LocalUcastMacs>> result = new HashMap<>();
DataObjectModification<HwvtepGlobalAugmentation> aug = mod.getModifiedAugmentation(HwvtepGlobalAugmentation.class);
if (aug != null && getModificationType(aug) != null) {
Collection<DataObjectModification<? extends DataObject>> children = aug.getModifiedChildren();
children.stream().filter(childMod -> getModificationType(childMod) != null).filter(childMod -> childMod.getDataType() == LocalUcastMacs.class).forEach(childMod -> {
LocalUcastMacs afterMac = (LocalUcastMacs) childMod.getDataAfter();
LocalUcastMacs mac = afterMac != null ? afterMac : (LocalUcastMacs) childMod.getDataBefore();
InstanceIdentifier<LocalUcastMacs> iid = parentIid.augmentation(HwvtepGlobalAugmentation.class).child(LocalUcastMacs.class, mac.getKey());
result.put(iid, (DataObjectModification<LocalUcastMacs>) childMod);
});
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs in project netvirt by opendaylight.
the class LocalUcastMacListener method added.
public void added(final InstanceIdentifier<LocalUcastMacs> identifier, final LocalUcastMacs macAdded) {
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, identifier, macAdded);
String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
String macAddress = macAdded.getMacEntryKey().getValue().toLowerCase(Locale.getDefault());
String elanName = getElanName(macAdded);
LOG.trace("LocalUcastMacs {} added to {}", macAddress, hwvtepNodeId);
ElanInstance elan = elanInstanceCache.get(elanName).orNull();
if (elan == null) {
LOG.warn("Could not find ELAN for mac {} being added", macAddress);
return;
}
jobCoordinator.enqueueJob(elanName + HwvtepHAUtil.L2GW_JOB_KEY, () -> {
L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
if (elanL2GwDevice == null) {
LOG.warn("Could not find L2GatewayDevice for ELAN: {}, nodeID:{} from cache", elanName, hwvtepNodeId);
return null;
}
elanL2GwDevice.addUcastLocalMac(macAdded);
elanL2GatewayUtils.installL2GwUcastMacInElan(elan, elanL2GwDevice, macAddress.toLowerCase(), macAdded, null);
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs in project netvirt by opendaylight.
the class LocalUcastCmd method transform.
@Override
public LocalUcastMacs transform(InstanceIdentifier<Node> nodePath, LocalUcastMacs src) {
LocalUcastMacsBuilder ucmlBuilder = new LocalUcastMacsBuilder(src);
ucmlBuilder.setLocatorRef(HwvtepHAUtil.convertLocatorRef(src.getLocatorRef(), nodePath));
ucmlBuilder.setLogicalSwitchRef(HwvtepHAUtil.convertLogicalSwitchRef(src.getLogicalSwitchRef(), nodePath));
ucmlBuilder.setMacEntryUuid(HwvtepHAUtil.getUUid(src.getMacEntryKey().getValue()));
LocalUcastMacsKey key = new LocalUcastMacsKey(ucmlBuilder.getLogicalSwitchRef(), ucmlBuilder.getMacEntryKey());
ucmlBuilder.setKey(key);
return ucmlBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs in project netvirt by opendaylight.
the class LocalUcastCmd method areEqual.
@Override
public boolean areEqual(LocalUcastMacs updated, LocalUcastMacs orig) {
InstanceIdentifier<?> updatedMacRefIdentifier = updated.getLogicalSwitchRef().getValue();
HwvtepNodeName updatedMacNodeName = updatedMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
InstanceIdentifier<?> origMacRefIdentifier = orig.getLogicalSwitchRef().getValue();
HwvtepNodeName origMacNodeName = origMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
return updated.getMacEntryKey().equals(orig.getMacEntryKey()) && updatedMacNodeName.equals(origMacNodeName);
}
Aggregations