本文整理了Java中org.opendaylight.ovsdb.utils.yang.YangUtils
类的一些代码示例,展示了YangUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangUtils
类的具体详情如下:
包路径:org.opendaylight.ovsdb.utils.yang.YangUtils
类名称:YangUtils
[英]YANG utility functions.
[中]阳效用函数。
代码示例来源:origin: org.opendaylight.ovsdb/utils.yang-utils
/**
* Converts a list of YANG key-value items to a map.
*
* @param yangList The list of YANG key-value items.
* @param keyExtractor The key extractor function to use.
* @param valueExtractor The value extractor function to use.
* @param <T> The YANG item type.
* @param <K> The key type.
* @param <V> The value type.
* @return The map.
*/
@Nonnull
public static <T, K, V> Map<K, V> convertYangKeyValueListToMap(@Nullable Iterable<T> yangList,
@Nonnull Function<T, K> keyExtractor,
@Nonnull Function<T, V> valueExtractor) {
return copyYangKeyValueListToMap(new HashMap<>(), yangList, keyExtractor, valueExtractor);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updatePortExternalIds(
final OvsdbTerminationPointAugmentation terminationPoint,
final Port port) {
List<PortExternalIds> portExternalIds = terminationPoint.getPortExternalIds();
if (portExternalIds != null && !portExternalIds.isEmpty()) {
try {
port.setExternalIds(YangUtils.convertYangKeyValueListToMap(portExternalIds,
PortExternalIds::getExternalIdKey, PortExternalIds::getExternalIdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB port external_ids", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
YangUtils.copyYangKeyValueListToMap(externalIdsMap, queueEntry.getQueuesExternalIds(),
QueuesExternalIds::getQueuesExternalIdKey, QueuesExternalIds::getQueuesExternalIdValue);
} catch (NullPointerException e) {
queue.setOtherConfig(YangUtils.convertYangKeyValueListToMap(queueEntry.getQueuesOtherConfig(),
QueuesOtherConfig::getQueueOtherConfigKey, QueuesOtherConfig::getQueueOtherConfigValue));
} catch (NullPointerException e) {
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
YangUtils.copyYangKeyValueListToMap(externalIdsMap, qosEntry.getQosExternalIds(),
QosExternalIds::getQosExternalIdKey, QosExternalIds::getQosExternalIdValue);
} catch (NullPointerException e) {
qos.setOtherConfig(YangUtils.convertYangKeyValueListToMap(qosEntry.getQosOtherConfig(),
QosOtherConfig::getOtherConfigKey, QosOtherConfig::getOtherConfigValue));
} catch (NullPointerException e) {
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void setOpenDaylightOtherConfig(@Nonnull Bridge bridge, @Nonnull OvsdbBridgeAugmentation ovsdbManagedNode) {
try {
bridge.setOtherConfig(YangUtils.convertYangKeyValueListToMap(ovsdbManagedNode.getBridgeOtherConfigs(),
BridgeOtherConfigs::getBridgeOtherConfigKey, BridgeOtherConfigs::getBridgeOtherConfigValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete bridge other config", e);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void setOpenDaylightExternalIds(Bridge bridge, InstanceIdentifier<OvsdbBridgeAugmentation> iid,
OvsdbBridgeAugmentation ovsdbManagedNode) {
// Set the iid external_id
Map<String, String> externalIdMap = new HashMap<>();
externalIdMap.put(SouthboundConstants.IID_EXTERNAL_ID_KEY, SouthboundUtil.serializeInstanceIdentifier(iid));
// Set user provided external ids
try {
YangUtils.copyYangKeyValueListToMap(externalIdMap, ovsdbManagedNode.getBridgeExternalIds(),
BridgeExternalIds::getBridgeExternalIdKey, BridgeExternalIds::getBridgeExternalIdValue);
} catch (NullPointerException e) {
LOG.warn("Incomplete bridge external Id", e);
}
bridge.setExternalIds(externalIdMap);
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createPortExternalIds(
final OvsdbTerminationPointAugmentation terminationPoint,
final Port port) {
List<PortExternalIds> portExternalIds = terminationPoint.getPortExternalIds();
if (portExternalIds != null && !portExternalIds.isEmpty()) {
try {
port.setExternalIds(YangUtils.convertYangKeyValueListToMap(portExternalIds,
PortExternalIds::getExternalIdKey, PortExternalIds::getExternalIdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB port external_ids", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createPortOtherConfig(
final OvsdbTerminationPointAugmentation terminationPoint,
final Port ovsPort) {
List<PortOtherConfigs> portOtherConfigs =
terminationPoint.getPortOtherConfigs();
if (portOtherConfigs != null && !portOtherConfigs.isEmpty()) {
try {
ovsPort.setOtherConfig(YangUtils.convertYangKeyValueListToMap(portOtherConfigs,
PortOtherConfigs::getOtherConfigKey, PortOtherConfigs::getOtherConfigValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB port other_config", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updateInterfaceExternalIds(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
List<InterfaceExternalIds> interfaceExternalIds =
terminationPoint.getInterfaceExternalIds();
if (interfaceExternalIds != null && !interfaceExternalIds.isEmpty()) {
try {
ovsInterface.setExternalIds(YangUtils.convertYangKeyValueListToMap(interfaceExternalIds,
InterfaceExternalIds::getExternalIdKey, InterfaceExternalIds::getExternalIdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface external_ids", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updatePortOtherConfig(
final OvsdbTerminationPointAugmentation terminationPoint,
final Port ovsPort) {
List<PortOtherConfigs> portOtherConfigs =
terminationPoint.getPortOtherConfigs();
if (portOtherConfigs != null && !portOtherConfigs.isEmpty()) {
try {
ovsPort.setOtherConfig(YangUtils.convertYangKeyValueListToMap(portOtherConfigs,
PortOtherConfigs::getOtherConfigKey, PortOtherConfigs::getOtherConfigValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB port other_config", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createInterfaceExternalIds(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
List<InterfaceExternalIds> interfaceExternalIds =
terminationPoint.getInterfaceExternalIds();
if (interfaceExternalIds != null && !interfaceExternalIds.isEmpty()) {
try {
ovsInterface.setExternalIds(YangUtils.convertYangKeyValueListToMap(interfaceExternalIds,
InterfaceExternalIds::getExternalIdKey, InterfaceExternalIds::getExternalIdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface external_ids", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updateInterfaceOptions(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
//Configure optional input
if (terminationPoint.getOptions() != null) {
try {
ovsInterface.setOptions(YangUtils.convertYangKeyValueListToMap(terminationPoint.getOptions(),
Options::getOption, Options::getValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface options", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createInterfaceBfd(final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
try {
List<InterfaceBfd> interfaceBfdList = terminationPoint.getInterfaceBfd();
if (interfaceBfdList != null && !interfaceBfdList.isEmpty()) {
try {
ovsInterface.setBfd(YangUtils.convertYangKeyValueListToMap(interfaceBfdList,
InterfaceBfd::getBfdKey, InterfaceBfd::getBfdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface bfd", e);
}
}
} catch (SchemaVersionMismatchException e) {
schemaMismatchLog("bfd", "Interface", e);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createInterfaceOptions(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
//Configure optional input
if (terminationPoint.getOptions() != null) {
try {
ovsInterface.setOptions(YangUtils.convertYangKeyValueListToMap(terminationPoint.getOptions(),
Options::getOption, Options::getValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface options", e);
}
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updateInterfaceBfd(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
try {
List<InterfaceBfd> interfaceBfdList =
terminationPoint.getInterfaceBfd();
if (interfaceBfdList != null && !interfaceBfdList.isEmpty()) {
try {
ovsInterface.setBfd(YangUtils.convertYangKeyValueListToMap(interfaceBfdList,
InterfaceBfd::getBfdKey, InterfaceBfd::getBfdValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface bfd", e);
}
}
} catch (SchemaVersionMismatchException e) {
schemaMismatchLog("bfd", "Interface", e);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void updateInterfaceLldp(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
try {
List<InterfaceLldp> interfaceLldpList =
terminationPoint.getInterfaceLldp();
if (interfaceLldpList != null && !interfaceLldpList.isEmpty()) {
try {
ovsInterface.setLldp(YangUtils.convertYangKeyValueListToMap(interfaceLldpList,
InterfaceLldp::getLldpKey, InterfaceLldp::getLldpValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface lldp", e);
}
}
} catch (SchemaVersionMismatchException e) {
schemaMismatchLog("lldp", "Interface", e);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
private void createInterfaceLldp(
final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
try {
List<InterfaceLldp> interfaceLldpList =
terminationPoint.getInterfaceLldp();
if (interfaceLldpList != null && !interfaceLldpList.isEmpty()) {
try {
ovsInterface.setLldp(YangUtils.convertYangKeyValueListToMap(interfaceLldpList,
InterfaceLldp::getLldpKey, InterfaceLldp::getLldpValue));
} catch (NullPointerException e) {
LOG.warn("Incomplete OVSDB interface lldp", e);
}
}
} catch (SchemaVersionMismatchException e) {
schemaMismatchLog("lldp", "Interface", e);
}
}
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
ovs.setExternalIds(YangUtils.convertYangKeyValueListToMap(ovsdbNode.getOpenvswitchExternalIds(),
OpenvswitchExternalIds::getExternalIdKey, OpenvswitchExternalIds::getExternalIdValue));
Mutate<GenericTableSchema> mutate = op.mutate(ovs)
if (otherConfigs != null) {
try {
ovs.setOtherConfig(YangUtils.convertYangKeyValueListToMap(otherConfigs,
OpenvswitchOtherConfigs::getOtherConfigKey, OpenvswitchOtherConfigs::getOtherConfigValue));
transaction.add(op.mutate(ovs).addMutation(ovs.getOtherConfigColumn().getSchema(),
代码示例来源:origin: org.opendaylight.ovsdb/southbound-impl
YangUtils.convertYangKeyValueListToMap(externalIds, OpenvswitchExternalIds::getExternalIdKey,
OpenvswitchExternalIds::getExternalIdValue));
Mutate<GenericTableSchema> mutate = op.mutate(ovs)
if (otherConfigs != null) {
try {
ovs.setOtherConfig(YangUtils.convertYangKeyValueListToMap(otherConfigs,
OpenvswitchOtherConfigs::getOtherConfigKey,
OpenvswitchOtherConfigs::getOtherConfigValue));
内容来源于网络,如有侵权,请联系作者删除!