use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs in project netvirt by opendaylight.
the class ElanBridgeManager method buildBridgeOtherConfigs.
private List<BridgeOtherConfigs> buildBridgeOtherConfigs(Node ovsdbNode, String bridgeName, String mac) {
// First attempt to extract the bridge augmentation from operational...
Node bridgeNode = southboundUtils.getBridgeNode(ovsdbNode, bridgeName);
OvsdbBridgeAugmentation bridgeAug = null;
if (bridgeNode != null) {
bridgeAug = southboundUtils.extractBridgeAugmentation(bridgeNode);
}
// ...if present, it means this bridge already exists and we need to take
// care not to change the datapath id. We do this by explicitly setting
// other_config:datapath-id to the value reported in the augmentation.
List<BridgeOtherConfigs> otherConfigs;
if (bridgeAug != null) {
DatapathId dpId = bridgeAug.getDatapathId();
if (dpId != null) {
otherConfigs = bridgeAug.getBridgeOtherConfigs();
if (otherConfigs == null) {
otherConfigs = Lists.newArrayList();
}
if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DATAPATH_ID))) {
String dpIdVal = dpId.getValue().replace(":", "");
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DATAPATH_ID).setBridgeOtherConfigValue(dpIdVal).build());
}
} else {
otherConfigs = Lists.newArrayList();
}
} else {
otherConfigs = Lists.newArrayList();
if (mac != null) {
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_HWADDR).setBridgeOtherConfigValue(mac).build());
}
}
if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DISABLE_IN_BAND))) {
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DISABLE_IN_BAND).setBridgeOtherConfigValue("true").build());
}
return otherConfigs;
}
Aggregations