use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project netvirt by opendaylight.
the class ElanBridgeManager method getDpIdFromManagerNodeId.
@Override
public Optional<BigInteger> getDpIdFromManagerNodeId(String managerNodeId) {
InstanceIdentifier<Node> identifier = getIntegrationBridgeIdentifier(managerNodeId);
OvsdbBridgeAugmentation integrationBridgeAugmentation = interfaceManager.getOvsdbBridgeForNodeIid(identifier);
if (integrationBridgeAugmentation == null) {
LOG.debug("Failed to get OvsdbBridgeAugmentation for node {}", managerNodeId);
return Optional.empty();
}
return Optional.ofNullable(integrationBridgeAugmentation.getDatapathId()).map(datapathId -> MDSALUtil.getDpnId(datapathId.getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.
the class OfToSalInPhyPortCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
final BigInteger datapathId = data.getDatapathId();
final PortNumber portNumber = source.getInPhyPort().getPortNumber();
if (portNumber != null) {
matchBuilder.setInPhyPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portNumber.getValue(), ofVersion));
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.
the class InventoryDataServiceUtil method nodeConnectorUpdatedBuilderFromDatapathIdPortNo.
public static NodeConnectorUpdatedBuilder nodeConnectorUpdatedBuilderFromDatapathIdPortNo(final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion) {
NodeConnectorUpdatedBuilder builder = new NodeConnectorUpdatedBuilder();
builder.setId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portNo, ofVersion));
builder.setNodeConnectorRef(InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, portNo, ofVersion));
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.
the class InventoryDataServiceUtil method nodeConnectorInstanceIdentifierFromDatapathIdPortno.
public static InstanceIdentifier<NodeConnector> nodeConnectorInstanceIdentifierFromDatapathIdPortno(final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion) {
NodeId nodeId = nodeIdFromDatapathId(datapathId);
KeyedInstanceIdentifier<Node, NodeKey> nodePath = NODES_IDENTIFIER.child(Node.class, new NodeKey(nodeId));
return nodeConnectorInstanceIdentifierFromDatapathIdPortno(datapathId, portNo, ofVersion, nodePath);
}
Aggregations